Charles Samuels <char...@cariden.com> wrote: > I have a single thread that wants to access an SQLite database, one of them > makes changes to them, the other one wants to look at an old version of the > same db. > > So, I have two handles to a db, say "H1" and "H2": > H1: begin transaction > H2: begin transaction > H1: insert ... > H2: select ... > H1: commit transaction > H2: commit transaction > > Is it possible to do this, and if so, how?
This sort of works, if a) you change the order of "commit transaction" statements (the reader clears off before the writer tries to commit), and b) you don't insert too much, so SQLite keeps your changes in the in-memory cache and doesn't have to spill to disk. With the latest SQLite versions, there is write-ahead logging (WAL) mode designed to support exactly your scenario: http://www.sqlite.org/wal.html -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users