Actually, in current versions of SQLite3 the error "(516) 
SQLITE_ABORT_ROLLBACK" is returned by "other commands" and not by the rollback 
command.  If the ROLLBACK command completed successfully (that is, it returned 
YaHoo! SQLITE_OK) then the transaction changes have been rolled back.  If "some 
other command" returns an error indicating that it was ABORTed then that other 
command was aborted and that has no bearing on whether or not changes to the 
database were rolled back.  They were.

I presume that if a SELECT was in progress during the time that a ROLLBACK was 
processed on the SAME CONNECTION and that the SELECT is allowed to proceed, 
that it will maintain the REPEATABLE READ isolation that it was commenced with 
and that when that statement is finalized, the transaction context will be 
released.  

Whether the connection is still "inside" the transaction or not can be 
determined by using the sqlite3_autocommit() API.  

Since this is kind of an undocumented grey area, I would suggest that you do 
not make the programming errors which would result in this situation (a 
Schrodinger Transaction state, for lack of a better descriptive).

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
>Sent: Saturday, 2 March, 2019 19:32
>To: SQLite mailing list
>Subject: Re: [sqlite] Handling ROLLBACK
>
>
>>Suppose ROLLBACK does not cancel the BEGIN, can a programmer
>reliably
>>issue more SQL commands, including another ROLLBACK ?  Will SQLite
>>continue to react correctly to other ROLLBACKs, and to SQL commands
>>which result in "(516) SQLITE_ABORT_ROLLBACK".
>
>A successful ROLLBACK on a transaction discards all changes that were
>made during the transaction (rolls back to the state at the time the
>transaction began), and ends the transaction.  It does not "cancel"
>the "BEGIN", it merely exits the transaction and discards changes
>made during the transaction.  Since the BEGIN occurred in the past,
>it cannot be "cancelled" ...
>
>Full Stop End of Line.
>
>However, a ROLLBACK command which produces the error "(516)
>SQLITE_ABORT_ROLLBACK" would indicate that the ROLLBACK was NOT
>PERFORMED due to an error.  Therefore the transaction is STILL IN
>EFFECT and has neither been COMMITed nor ROLLBACKed.  Once the
>programming error which prevented the rollback is cleared the
>ROLLBACK command can be retried.  Once a transaction is opened it
>remains in effect until ROLLBACK or COMMIT complete successfuly (or
>the heat death of the universe, whichever shall come first).
>
>Note that this discussion does not include "fatal errors" which may
>occur within the context of a transaction that abort the transaction
>itself.
>
>---
>The fact that there's a Highway to Hell but only a Stairway to Heaven
>says a lot about anticipated traffic volume.
>
>
>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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

Reply via email to