sql.Query: Roll back transactions on errors

This commit is contained in:
Florian Bruhin 2018-09-01 12:10:21 +02:00
parent aff1108836
commit 47218e5402

View File

@ -205,7 +205,12 @@ class Query:
self._check_ok('transaction', ok)
ok = self.query.execBatch()
self._check_ok('execBatch', ok)
try:
self._check_ok('execBatch', ok)
except SqliteError:
# Not checking the return value here, as we're failing anyways...
db.rollback()
raise
ok = db.commit()
self._check_ok('commit', ok)