sql.Query: Make sure transaction/commit succeed

This commit is contained in:
Florian Bruhin 2018-09-01 12:09:01 +02:00
parent 992f13b5b8
commit aff1108836

View File

@ -201,11 +201,14 @@ class Query:
raise SqlError("Missing bound values!")
db = QSqlDatabase.database()
db.transaction()
ok = db.transaction()
self._check_ok('transaction', ok)
ok = self.query.execBatch()
self._check_ok('execBatch', ok)
db.commit()
ok = db.commit()
self._check_ok('commit', ok)
def value(self):
"""Return the result of a single-value query (e.g. an EXISTS)."""