Fix dbapi to support "Abandon Changes & Quit" feature

Fixes #11599
This commit is contained in:
prculley 2020-03-07 09:31:18 -06:00 committed by Paul Culley
parent e34b98033e
commit 0a3a65ffb0
2 changed files with 5 additions and 1 deletions

View File

@ -535,7 +535,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
self.undo_history_callback = None
self.modified = 0
self.transaction = None
self.abort_possible = False
self.abort_possible = True
self._bm_changes = 0
self.has_changed = False
self.surname_list = []

View File

@ -231,6 +231,10 @@ class DBAPI(DbGeneric):
_LOG.debug(" %sDBAPI %s transaction begin for '%s'",
"Batch " if transaction.batch else "",
hex(id(self)), transaction.get_description())
if transaction.batch:
# A batch transaction does not store the commits
# Aborting the session completely will become impossible.
self.abort_possible = False
self.transaction = transaction
self.dbapi.begin()
return transaction