I've looked everywhere, and I can't work out whats going wrong.
I want to be able to queue up a few database queries, and be able to roll them back if any query should fail. I couldn't get that to work, so I tried reducing the problem to a simple example (started transaction, ran two queries, tried rolling back) but even that isn't working.
This code should; start a transaction, attempt to create two tables, and then be rolled back so no changes appear in the database.
The call to rollback() is returning true, so it says its working, but when I look in the database, the tables were created anyway.
Here's my code:
db = QSqlDatabase.database()
db.transaction()
q = QSqlQuery(db)
q.exec_("create table a ...") #omitted but I have checked they are fully valid queries
q.exec_("create table b ...")
db.rollback()