SQLite Forum

Updating in-process connections on write
Login
> The problem I'm having is that sometimes, after completing a write transaction, the RO connection doesn't "see" the change.

That is correct.  WHen using the WAL journal mode, a connection will not "see" any changes made to the database on a different connection until the specific sequence (1) commits, either implicitly or explicitly, the changes; and then (2) the original connection (the one that you want to see the changes) must BEGIN A TRANSACTION, either explicitly or implicitly, in order to see the changes to the database made on the other connection.

This means that, for a connection, if the following holds:

 - sqlite3_txn_state returns 0 <https://sqlite.org/c3ref/txn_state.html>

Then a SELECT issued against that connection will "see" all changes committed to the database **BEFORE** the above condition was tested.

((Actually, that would be all changes committed before the statement which starts the transaction, not from the time the condition was tested.))