On 16 Jul 2012, at 2:59pm, "Igor Tandetnik" <itandet...@mvps.org> wrote:

> Durga D <durga.d...@gmail.com> wrote:
>>   So, I can establish x connections in app initialize time in WAL mode.
>> Based on request (read or write), I can pick the connection and serve.
>> Allows only one write at a time.
> 
> I'm not sure what you mean by picking a connection based on a request. It's 
> not connections that are readers or writers - transactions are. A connection 
> may execute a read-only transaction, then later a write transaction, then a 
> read transaction again, and so on.
> 
> You cannot have two write transactions (on two separate connections) active 
> at the same point in time - one of them will block the other.

Igor forgot to explain that WAL mode affects the database file.  You don't put 
a connection into WAL mode, something is stored with the database file which 
means that everything that talks to it will automatically use WAL mode.

So you'll probably do something like this:

Create a blank database file
Put it into WAL mode using "PRAGMA journal_mode=WAL" (you can do this at any 
time, even after data is written)
Make some tables (and put some data in if you want)
Close the file

Then you can write your apps to do whatever accessing you want.  Each app would 
open one connection to the database, and use that connection for whatever 
requests you want, in any order you want.  Each request gets its own 'handle' 
and stores its own command and its own results.

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

Reply via email to