just wondering if someone can help out a wee bit here.
I am using SQLite transactions and wish to roll-back if there is an error processing any of the statements within the transaction. At the moment, I am having to examine every statement to see if there is an error, but there must surely be a better, more efficient, way?
Is there some way of checking for any error, just once, immediately prior to committing the transaction? Some flag or other which will tell me if any of the preceding statements produced some kind of error?
Code: Select all
DatabaseUpdate(#db, "BEGIN TRANSACTION")
DatabaseUpdate(#db, ......)
DatabaseUpdate(#db, ......)
DatabaseUpdate(#db, ......)
DatabaseUpdate(#db, ......)
DatabaseUpdate(#db, ......)
DatabaseUpdate(#db, ......)
If error detected in any of the above statements...
DatabaseUpdate(#db, "ROLLBACK")
Else
DatabaseUpdate(#db, "COMMIT")
EndIf
Thanks.

