I’m not sure if this is a bug or something else, but I’m having issues with the new SQLiteDatabase always storing logged changes in the -shm and -wal files even after using
myDB.SQLExecute("COMMIT") and after closing out the database connection completely. I can’t seem to get those files/changes to be rolled into the main database file no matter what I’m doing.
This is on 2015r3.1
My first thought is that you have an error in the SQL and you’re not checking for the database error. Committing will do nothing if you have an error.
Show us the code you have right before you’re trying to commit.
I’m not getting any SQL errors and the changes are saving correctly (to the shm/wal files). I’m not even trying to do these as BEGIN/COMMIT transactions for this purpose.
It looks like I need to initiate sqlite3_wal_checkpoint_v2 but I’m having trouble getting that to work.
Looks like if I execute a
PRAGMA wal_checkpoint(FULL); then it works to properly move the changes to the original database, even though WAL and SHM files still exist.
wal is the write ahead log
and it still being present almost sounds like you have a begin transaction without a matching close
otherwise the wal log SHOULD automagically be removed when the commits occur
See 2.2 and 2.3 here https://www.sqlite.org/tempfiles.html