Don Lavelle <[EMAIL PROTECTED]>
wrote:
Second, my question is about SQLite and multi-threading.  Basically,
the snippet below means that if I have multiple threads executing SQL
statements, and I want at least one thread to execute multiple SQL
statements as a single unit, I need to make sure only one thread at a
time is executing SQL, or the SQL statements that are outside of the
thread may get lumped in with the transaction.  As in,

10. thread 1: shut off auto commit
20. thread 1: SQL statement 1 succeeds
30. thread 2: independent SQL statement succeeds
40. thread 1: SQL statement 2 fails
50. thread 1: rollback, taking with it thread 2's effect

This is correct, assuming both threads are using the same database connection. The behavior would be different if each thread opens its own connection (specifically, the second connection could not successfully commit a change at #30).

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to