From 6cee8b7a97f1fe81fe7a2b22f264ae8cbed1025d Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 26 Apr 2009 21:47:28 +0100 Subject: [PATCH] always release locks when db work finished --- pyfpdb/fpdb_import.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 8b567032..4a210d35 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -67,6 +67,7 @@ class Importer: self.settings['handCount'] = 0 self.fdb = fpdb_db.fpdb_db() # sets self.fdb.db self.fdb.cursor and self.fdb.sql self.fdb.do_connect(self.config) + self.fdb.db.rollback() #Set functions def setCallHud(self, value): @@ -235,6 +236,7 @@ class Importer: self.caller.pipe_to_hud.stdin.write("%s" % (handsId) + os.linesep) except fpdb_simple.DuplicateError: duplicates+=1 + self.fdb.db.rollback() except (ValueError), fe: errors+=1 self.printEmailErrorMessage(errors, file, hand) @@ -242,6 +244,8 @@ class Importer: if (self.settings['failOnError']): self.fdb.db.commit() #dont remove this, in case hand processing was cancelled. raise + else: + self.fdb.db.rollback() except (fpdb_simple.FpdbError), fe: errors+=1 self.printEmailErrorMessage(errors, file, hand)