devotee
devotee

Reputation: 127

Sqlite rollback after commit

In Sqlite3, is there a way to rollback to a point after committing a transaction? If you are wondering why I am committing a statement if I am not sure, the reason is that I am using Sqlite from inside a C++ interface, which only saves to the file if I commit the transaction.

Upvotes: 1

Views: 2763

Answers (1)

Googie
Googie

Reputation: 6017

Make a copy of the database before commiting transaction. To do copy I suggest to use sqlite3_backup_*() functions family, as they guarantee an operation to be atomic.

If you have big database and you want to do this only with 1 table (this tricky "rollback"), then you should keep the table in a separate database and ATTACH it when used, so you can backup only the database with a single table.

Upvotes: 2

Related Questions