On 6 Jul 2012, at 4:00pm, Jonathan Haws <jonathan.h...@sdl.usu.edu> wrote:
> So, then what is the best way to make a query from one process pend until the > database is available? > > For example, let's say I have two processes that connect to the same database > file. One process wants to read from the database, but the other process is > in the middle of a write. Does the first process pend on the read or not? > If it does not, what does it return? Is it a successful read? What about > the reverse case when the first process wants to write but the second process > is reading? Yes. SQLite does database-level locking, trying its best not to lock the database until it knows that you're definitely going to make changes to it. The result is roughly what you describe. > Is this what I would use sqlite3_busy_timeout() for? Yes. Set a busy timeout for however long you want your app to wait before giving up. Ten seconds ? Five minutes ? If the second process can't get access in this time you get one of the result codes, probably SQLITE_BUSY or SQLITE_LOCKED. That's one of the reasons you collect and check the result code from every SQLite call. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users