From 9b99530add7a1dda7c7b0b9229930f197018f9c8 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 23 Nov 2011 08:14:20 +0000 Subject: [PATCH] minor bug fix --- lib/utils/hashdb.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index a77b8390c..ce7ae7f39 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -22,6 +22,7 @@ class HashDB(object): self.filepath = filepath self._write_cache = {} self._cache_lock = threading.Lock() + self._in_transaction = False def _get_cursor(self): threadData = getCurrentThreadData() @@ -108,7 +109,11 @@ class HashDB(object): self.endTransaction() def beginTransaction(self): - self.cursor.execute('BEGIN TRANSACTION') + if not self._in_transaction: + self.cursor.execute('BEGIN TRANSACTION') + self._in_transaction = True def endTransaction(self): - self.cursor.execute('END TRANSACTION') + if self._in_transaction: + self.cursor.execute('END TRANSACTION') + self._in_transaction = False