From d726050bc4d136f3e5e57883022b34f78c7ea96d Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 5 Dec 2014 11:46:03 +0100 Subject: [PATCH] Patch for an Issue #991 --- lib/utils/hashdb.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index 9c42cf884..d0e57c3df 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -139,8 +139,15 @@ class HashDB(object): def beginTransaction(self): threadData = getCurrentThreadData() if not threadData.inTransaction: - self.cursor.execute("BEGIN TRANSACTION") - threadData.inTransaction = True + try: + self.cursor.execute("BEGIN TRANSACTION") + except: + # Reference: http://stackoverflow.com/a/25245731 + self.cursor.close() + threadData.hashDBCursor = None + self.cursor.execute("BEGIN TRANSACTION") + finally: + threadData.inTransaction = True def endTransaction(self): threadData = getCurrentThreadData()