SQLite Forum

classic save possibility
Login
Be sure to think through the ramifications of what you are trying to do, and if there is any possibility of multiple actors working on the same database. 

Depending on the requirements, saving a. mirror of the old as a 'backup' that you can roll back to, or working with the mirror might be better. It somewhat depends on how often/likely you are to want to do that rollback.

Saving the backup and working with the original will avoid needing to worry about merging conflicts from other accesses to the file unless you actually want to do a rollback, but this won't seem like the Document case, but in the document case, normally no one else is allowed to access the document while you are editing, or maybe only in a read-only mode.

If you want to recreate that, make the copy and use it, but start a BEGIN IMMEDIATE transaction on the original so no one else can modify it. Then rolling in the new database won't need the check for conflicts.

The fundamental issue is a database really isn't just like a simple document, so a flow that treats it as one will have problems.