avoid open transactions between calls

This commit is contained in:
Mike McLean 2009-10-07 15:13:55 -04:00
parent ce0a7aa9b4
commit 5088019eac

View file

@ -60,9 +60,12 @@ class DBWrapper:
# this DBWrapper is no longer usable after close()
if not self.cnx:
raise StandardError, 'connection is closed'
self.cnx.rollback()
self.cnx.cursor().execute('ROLLBACK')
#We do this rather than cnx.rollback to avoid opening a new transaction
#If our connection gets recycled cnx.rollback will be called then.
self.cnx = None
class CursorWrapper:
def __init__(self, cursor, debug=False):
self.cursor = cursor