SQLite Forum

Recover Database
Login
Thank you. This is a clear and concise explanation.

This is the text that confused me:
The SAVEPOINT command starts a new transaction with a name. The transaction names need not be unique. A SAVEPOINT can be started either within or outside of a BEGIN...COMMIT. When a SAVEPOINT is the outer-most savepoint and it is not within a BEGIN...COMMIT then the behavior is the same as BEGIN DEFERRED TRANSACTION.

So the correct way is:
BEGIN TRANSACTION;
 do something
  set a save point for the next step
  and do so more and if it fails rollback to to the save point for a do-over.

when finished execute END; or COMMIT;