Hi,

For example, would I do this:
Connect to the DB
[ Pass the command to save: ]    SAVEPOINT 'current'
[ User choices are processed: SELECT and UPDATE statements ]
[ if error or user changes their mind ]    ROLLBACK TRANSACTION TO
SAVEPOINT 'current'

[ otherwise... upon success ]    RELEASE SAVEPOINT 'current'

That looks pretty good. I think you also need to RELEASE the SAVEPOINT after you've ROLLed BACK to it (if you no longer want it) otherwise it stays on the stack so that you can ROLLBACK to it again.



I have also recently implemented something using SAVEPOINT TRANSACTIONS and I'm unclear (having read the docs) what state one can expect statements to be in after a ROLLBACK. One of the mental models says that it's as if the transaction was restarted from the beginning, up until the SAVEPOINT. However, I assume that SELECT statements stay put, returning the next row after the one that was last fetched rather the one that was fetched immediately after the first time that the SAVEPOINT was passed.

Does anyone know what the guarantees are?




andy...@ashurst.eu.org
http://www.ashurst.eu.org/
http://www.gonumber.com/andyjpb
0x7EBA75FF
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to