avoid open transactions between calls
This commit is contained in:
parent
ce0a7aa9b4
commit
5088019eac
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue