minor bug fix

This commit is contained in:
Miroslav Stampar 2011-11-23 08:14:20 +00:00
parent d5cddd40f6
commit 9b99530add

View File

@ -22,6 +22,7 @@ class HashDB(object):
self.filepath = filepath self.filepath = filepath
self._write_cache = {} self._write_cache = {}
self._cache_lock = threading.Lock() self._cache_lock = threading.Lock()
self._in_transaction = False
def _get_cursor(self): def _get_cursor(self):
threadData = getCurrentThreadData() threadData = getCurrentThreadData()
@ -108,7 +109,11 @@ class HashDB(object):
self.endTransaction() self.endTransaction()
def beginTransaction(self): 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): def endTransaction(self):
self.cursor.execute('END TRANSACTION') if self._in_transaction:
self.cursor.execute('END TRANSACTION')
self._in_transaction = False