A further question to this. If process B tries to access a table which process A is currently writing to, is an error returned or does sqlite block? I very much need SQLite to block - is there an option for that?
Thanks, Ian On 12/06/2011 12:23, Simon Slavin wrote: > On 12 Jun 2011, at 12:07pm, Ian Hardingham wrote: > >> I believe it's fine to have four applications open the same database >> file and use it concurrently. > Assuming you are compiling without any special directives which turn this > ability off. For instance, read about everything mentioned in the section: > > <http://www.sqlite.org/compile.html#threadsafe> > > Apart from that, just use transactions properly. Most people ask this > question about 'multiple processes' so any previous answers about this are > answers to your question. > >> I have a few questions. >> >> 1. Do I need to use any special PRAGMA or other option to use this >> functionality best? > No. Just don't use PRAGMAs to defeat anything SQLite does by default. Many > of the PRAGMAs which are normally used to speed SQLite up do it by defeating > the multi-user ability. If you leave stuff alone it should all work fine. > >> 2. Is it possible to (ab)use SQLite to perform as some kind of mutex? >> Could I go "down" on one table and "up" once I've finished a section of >> code in my application which I wish to be only run once at any given time? > I'm not certain I understand your question but SQLite performs a kind of > mutexing by default. If you want to use SQLite as a semaphore system between > applications you can do it by having applications perform (or try to perform) > BEGIN EXCLUSIVE and see what result code they get. > > Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

