Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Pero Mirko
OK, I think I got it. Thank you both Igor and Simon for your kind answers! ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Simon Slavin
On 5 Oct 2011, at 6:40pm, Pero Mirko wrote: > So in other words a pseudo function like this: > > BEGIN EXCLUSIVE > if anyerror return > INSERT INTO [table] > if anyerror ROLLBACK > INSERT INTO [table] > if anyerror ROLLBACK > UPDATE [table] > if anyerror ROLLBACK > UPDATE [table] > if anyerror

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Igor Tandetnik
On 10/5/2011 1:40 PM, Pero Mirko wrote: So in other words a pseudo function like this: BEGIN EXCLUSIVE if anyerror return INSERT INTO [table] if anyerror ROLLBACK INSERT INTO [table] if anyerror ROLLBACK UPDATE [table] if anyerror ROLLBACK UPDATE [table] if anyerror ROLLBACK COMMIT if anyerror

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Pero Mirko
So in other words a pseudo function like this: BEGIN EXCLUSIVE if anyerror return INSERT INTO [table] if anyerror ROLLBACK INSERT INTO [table] if anyerror ROLLBACK UPDATE [table] if anyerror ROLLBACK UPDATE [table] if anyerror ROLLBACK COMMIT if anyerror ROLLBACK return Would that guarantee

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Simon Slavin
On 5 Oct 2011, at 5:42pm, Pero Mirko wrote: > Furthermore doing something like: > BEGIN EXCLUSIVE > INSERT OR ROLLBACK INTO table > INSERT OR ROLLBACK INTO table > INSERT OR ROLLBACK INTO table > COMMIT > > also doesn't make sense - because if first insert is successful and second > is not it

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Igor Tandetnik
On 10/5/2011 12:42 PM, Pero Mirko wrote: 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

Re: [sqlite] how to do automatic rollback on any error?

2011-10-05 Thread Pero Mirko
> > >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

Re: [sqlite] how to do automatic rollback on any error?

2011-10-03 Thread Igor Tandetnik
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

[sqlite] how to do automatic rollback on any error?

2011-10-03 Thread Pero Mirko
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? What happens if I have 20 queries, 10 execute successfully (after COMMIT) and then it fails - will the database