[Koha-patches] commit 96869b85b23c2a9c023865ada44cc264bfff16b0

Henri-Damien LAURENT henridamien at koha-fr.org
Thu Apr 24 10:05:49 CEST 2008


    NoZebra : Commiting things only when done

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 178a332..4555c62 100755
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -2069,6 +2069,7 @@ sub ModZebra {
         # lock the nozebra table : we will read index lines, update them in Perl process
         # and write everything in 1 transaction.
         # lock the table to avoid someone else overwriting what we are doing
+        $dbh->{AutoCommit} = 0;
         $dbh->do('LOCK TABLES nozebra WRITE,biblio WRITE,biblioitems WRITE, systempreferences WRITE, auth_types WRITE, auth_header WRITE');
         my %result; # the result hash that will be builded by deletion / add, and written on mySQL at the end, to improve speed
         if ($op eq 'specialUpdate') {
@@ -2076,6 +2077,7 @@ sub ModZebra {
             # 1st delete (virtually, in indexes), if record actually exists
             if ($oldRecord) { 
                 %result = _DelBiblioNoZebra($biblionumber,$oldRecord,$server);
+                $dbh->commit();
             }
             # ... add the record
             %result=_AddBiblioNoZebra($biblionumber,$newRecord, $server, %result);
@@ -2091,6 +2093,8 @@ sub ModZebra {
                 $sth->execute($result{$key}->{$index}, $server, $key, $index);
             }
         }
+        $dbh->commit();
+        $dbh->{AutoCommit} = 1;
         $dbh->do('UNLOCK TABLES');
 
     } else {



More information about the Koha-patches mailing list