minor fix

This commit is contained in:
Miroslav Stampar
2011-11-23 14:26:40 +00:00
parent 9b99530add
commit 14e8ca6d41
3 changed files with 17 additions and 6 deletions

View File

@@ -22,7 +22,6 @@ class HashDB(object):
self.filepath = filepath
self._write_cache = {}
self._cache_lock = threading.Lock()
self._in_transaction = False
def _get_cursor(self):
threadData = getCurrentThreadData()
@@ -109,11 +108,13 @@ class HashDB(object):
self.endTransaction()
def beginTransaction(self):
if not self._in_transaction:
threadData = getCurrentThreadData()
if not threadData.inTransaction:
self.cursor.execute('BEGIN TRANSACTION')
self._in_transaction = True
threadData.inTransaction = True
def endTransaction(self):
if self._in_transaction:
threadData = getCurrentThreadData()
if threadData.inTransaction:
self.cursor.execute('END TRANSACTION')
self._in_transaction = False
threadData.inTransaction = False