On 03/14/2012 06:09 PM, rahul dev wrote:
Guys,

    I am using sqlite version 3.7.10. My application is multi-threaded and each 
thread opens a separate connection to the the same database file.
I want my database operations to be thread-safe and as concurrent as possible. 
Can you please tell me what sqlite compile flags should I use ?

I am passing THREADSAFE=2. Is that right ?
Or should I use THREADSAFE=1 ? But, in that case even the concurrent reads will 
be serialized. So, THREADSAFE=2 seems to be a better option ?

With THREADSAFE=1, calls made on a single database handle
are serialized. But calls made on separate handles may still
run concurrently. THREADSAFE=2 just allows you to avoid the
overhead imposed by the mutex used to serialize the calls
made on a single database handle.

You can also change the threading model using sqlite3_config()
at runtime.


Secondly, I am running the application on a propreitary
filesystem/operating-system that does *NOT* support unix like file
locking semantics. However, flock() is supported on my system. What
option should I pass so that "dotlockLockingStyle" or "unix-flock" may
be used ?


Pass something like "unix-flock" as the fourth argument to
sqlite3_open_v2() when opening the database connection.

If I pass 'SQLITE_ENABLE_LOCKING_STYLE', my compilation fails with
error error: storage size of 'fsInfo' isn't known cc1: warnings being
treated as errors /src/sqlite3.c:30079: error:
implicit declaration of function 'fstatfs'

Is this a known problem ? What should I do to take care of the above
compilation problem ?

SQLITE_ENABLE_LOCKING_STYLE only works on osx.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to