Am 21.10.2005 um 11:58 schrieb Michael J. Sviridov:
Using sqlite 3.2.7 in a multi-threaded C++ application:
I've got two thread's (with unique db handles), each thread does the
following:
BEGIN EXCLUSIVE TRANSACTION;
(60,000 INSERT OR REPLACE statements into the same table)
COMMIT TRANSACTION;
This works fine, as expected, one thread acquires the lock and the
other
thread wait's for it to be released in a SQLITE_BUSY loop.
My question: Is the same thing possible/safe with a DEFERRED or
IMMEDIATE
transaction?
When I use an EXCLUSIVE transaction all is well, but if I try to use a
DEFERRED or IMMEDIATE transaction I randomly get SQLITE_ERROR from
sqlite3_step() on one or two of the INSERT OR REPLACE statements.
My indexes
are also sometimes corrupted after this. Am I missing something?
We're using sqlite in a heavily threaded app as well and we haven't
yet seen any such problem.
Which version of sqlite are you using (there was one version that had
a thread-safety problem)?
Are you sure you built with THREADSAFE=1 ?
</jum>