On 10/3/2011 3:21 PM, Pero Mirko wrote:
If I do

BEGIN EXCLUSIVE
..... insert / update / delete queries here....
COMMIT

does it guarantee it will automatically rollback if the error occurs or do I
have to specify it manually?

http://sqlite.org/lang_conflict.html

What happens if I have 20 queries, 10 execute successfully (after COMMIT)
and then it fails - will the database insert / update / delete first 10 or
will it return to initial state before any inserts?

The default behavior is ABORT, which means the statement that caused the error is rolled back, but the transaction stays open with any prior changes still in place. If you COMMIT at this point, those changes will get committed.

Or do I have to use something like INSERT INTO [table] OR ROLLBACK... or
something like that?

Either that, or you'll have to check for errors and, if any occur, issue a ROLLBACK statement.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to