Igor Korot wrote:
Hi, ALL,
Is it possible to have transaction inside transaction? Will it be
handled correctly?

What I mean is: crate transaction 1 by issuing "BEGIN", create
transaction 2 by issuing "BEGIN".
Close transaction 2 by issuing either "COMMIT" or "ROLLBACK".
If "ROLLBACK" is issued, issue "ROLLBACK" on transaction 1.
If "COMMIT" is issued, continue transaction 1.

Thank you.

Didn't you mean to say, "regardless of how (inner) transaction 2 ends, continue transaction 1"?

Being able to rollback part of a main transaction without rolling back the whole thing is the whole point of nested transactions. (Likewise for "savepoints", which are different syntax but the same functionality.)

If you want a rollback on the inner to rollback the outer unconditionally, you never needed a nested transaction in the first place, but rather just the one outer transaction 1, or you might have wanted an autonomous transaction, which is different, depending on what you want.

-- Darren Duncan

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to