On 6/22/2014 6:33 PM, João Ramos wrote:
What happens is this: - a thread acquires the write DB connection - that
thread inserts a new row in a table and gets its id - the thread releases
the write DB connection (so that other threads can use it) - the same
thread acquires (its own) read-only DB connection - thread tries to read
the row it just inserted and it returns NULL

Well, it's a *shared* cache. All connections reading from the cache must needs see the same data - namely, the data observed by the oldest still-open transaction.

A shared cache is an in-memory construct that holds a single "real" connection to the actual database file; all connections to the shared cache go through this single "real" connection. Say, connection A starts reading at time T - this initiates a read transaction on the "real" connection. Connection B starts reading at time T+2 - that becomes part of the same transaction. A may stop reading (e.g. reset its statement) at time T+3 - but B still reads the data as it existed at time T, and cannot observe any changes made at T+1.
--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to