Andrew Clark wrote:

Not knowing the code that well but guessing I would say that because the statements are on a single line I believe maybe the SQL interpreter is reading the BEGIN (start a transaction) but not reading the rest of the commands when an error occurs and therefore doesn't see the COMMIT (end transaction) at the end.



That is correct. When you have multiple statements in a single sqlite3_exec() and an error is encountered in one of the statements in the middle, none of the statements that follow are executed. This is by design.

I find it useful to execute the COMMIT using a separate sqlite3_exec().
If the first sqlite3_exec() returns successfully, then execute COMMIT
in a separate sqlite3_exec(), otherwise issue a ROLLBACK.


-- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565



Reply via email to