From 9b82c7c5715fcc976cf22ab35465e12782cb47ae Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Thu, 16 Mar 2017 20:59:35 +0200 Subject: [PATCH] Bug 18285: Koha::Database schema cache accessors Content-Type: text/plain; charset=utf-8 Safe way of getting and flushing the $database->{schema} -cache. This is needed by Test::DBIx::Class to overcome pre-initialization connection caching from C4::Context and others. See Bug 18286. Signed-off-by: Marcel de Rooy --- Koha/Database.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Koha/Database.pm b/Koha/Database.pm index df259c5..7daf5f0 100644 --- a/Koha/Database.pm +++ b/Koha/Database.pm @@ -215,6 +215,23 @@ sub restore_schema { # return something, then this function should, too. } +=head2 get_schema_cached + +=cut + +sub get_schema_cached { + return $database->{schema}; +} + +=head2 flush_schema_cache + +=cut + +sub flush_schema_cache { + delete $database->{schema}; + return 1; +} + =head2 EXPORT None by default. -- 2.1.4