jeff archer <jarch...@yahoo.com> wrote:
> I am using SQLite from C++ and I have implemented a class to manager nested
> transactions using savepoints. I have currently implemented as a stack of
> transactions such that the first Begin uses BEGIN IMMEDIATE, while subsequent
> levels use SAVEPOINT Tnnnn where nnnn is a sequentially increasing number
> starting at 0001. Commit does RELEASE on the latest SAVEPOINT or a real COMMIT
> once savepoint stack is cleared. Rollback does ROLLBACK TO or a real ROLLBACK
> once savepoint stack is cleared.
> 
> Is this OK to mix savepoints with transactions like this?

Yes. That's precisely the intended use case. Remember though that the 
transaction is not really committed until COMMIT statement runs: if your 
application crashes or machine loses power, all changes to the beginning of the 
transaction are rolled back, not just those since last "committed" checkpoint.
-- 
Igor Tandetnik


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

Reply via email to