Bug 7276 : Follow up, adding a sub to clear the cache
authorChris Cormack <chrisc@catalyst.net.nz>
Tue, 6 Dec 2011 22:07:23 +0000 (11:07 +1300)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 17 Jan 2012 17:13:52 +0000 (18:13 +0100)
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/SQLHelper.pm

index 900e40d..41c5a9f 100644 (file)
@@ -54,6 +54,7 @@ BEGIN {
        SearchInTable
        UpdateInTable
        GetPrimaryKeys
+        clear_columns_cache
 );
        %EXPORT_TAGS = ( all =>[qw( InsertInTable DeleteInTable SearchInTable UpdateInTable GetPrimaryKeys)]
                                );
@@ -252,6 +253,23 @@ sub GetPrimaryKeys($) {
        return  grep { $hash_columns->{$_}->{'Key'} =~/PRI/i}  keys %$hash_columns;
 }
 
+
+=head2 clear_columns_cache
+
+  C4::SQLHelper->clear_columns_cache();
+
+cleans the internal cache of sysprefs. Please call this method if
+you update a tables structure. Otherwise, your new changes
+will not be seen by this process.
+
+=cut
+
+sub clear_columns_cache {
+    %$hashref = ();
+}
+
+
+
 =head2 _get_columns
 
     _get_columns($tablename)