SQLite Forum

open db in read only; explicitly store diff as WAL ?
Login
Well, you cannot do that (not to mention that there is no point, really).

You can make a copy of the old.db to another file, say new.db, then update that, then generate a diff (either a binary diff in the usual fashion, on an SQL commands diff) between the two files.  Applying the diff to the old.db will produce the new.db.  (The SQL diff is merely the SQL commands that need to be applied to the old.db to get the new.db -- which you already have since you issued those commands).

Though I do have to wonder why you would want to go to all the bother?

You already know all the commands that you applied to the copy of old.db to get to the new.db, and that is what the diff will output (an SQL diff).  On the other hand, a binary diff will only work to transform the exact old.db (not one that is merely similar) into exactly the new.db (which you already have).

Given this, I kind of wonder what the point would be?

You can also take a look at the session extension (<https://sqlite.org/sessionintro.html>) which will allow you to "record" the updates into a changeset while you make them for the purpose of applying them to a "similar database".