On Apr 15, 2008, at 11:31 AM, Shawn Wilsher wrote:
>> 1) If shared, then the second threads insert is part of the  
>> transaction and should succeed.
>> 2) No.
>> 3) If the connection is shared between threads, there can only be 1  
>> txn at a time. The second threads attempt to begin a txn will  
>> result in an error that indicates a txn is already active.
> To be clear, when using a shared cache and more than one sqlite3
> connection object, only one transaction will exist at a time, correct?

Correct.

>
> However, if it is not using the shared cache, you can have a
> transaction opened up for each thread?
>

Well, sort of.  Certainly true if each connection has a different
database open.  But there can only be one write transaction at
a time to a single database.  If you have multiple connections to
the same database file, one can have a write transaction open
and one or more others can have a read transaction open, but
you cannot have two or more write transactions active at once
and all of the read transactions will need to close prior to the
write transaction committing (otherwise the writer gets an
SQLITE_BUSY.)

D. Richard Hipp
[EMAIL PROTECTED]



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

Reply via email to