In the past I've used PostgreSQL quite a bit. Now I'm using SQLiteCpp in this pr...

@charette@mstdn.ca

In the past I've used PostgreSQL quite a bit.

Now I'm using SQLiteCpp in this project. I had no idea about WAL files. Basically SQLite stores new rows and changes in a WAL (write-ahead logging) file. This is only committed to the .db file once it grows past a certain size. The database is actually the combination of the .db file and the .wal file.

Here I was, copying my .db file and inspecting it with sqlitebrowser, and couldn't figure out why my changes weren't in the database.

To force SQLite to immediately merge in the WAL file into the database:

db.exec("PRAGMA wal_checkpoint(TRUNCATE)");