Igor Mironchick <[EMAIL PROTECTED]>
wrote:
a) If one thread "BEGIN" and after that another thread try to "BEGIN".
What will with the second thread? How I understand there is nothing
wrong. Is it right?

No problem. It's OK for two or more threads to issue BEGIN statement. Such a statement doesn't actually touch the database at all, just sets some flag in the connection structure.

b) The same one only when second thread "BEGIN" after first thread
"BEGIN" and "INSERT" but before "COMMIT"? Here, how I understand,
second thread will get "SQLITE_BUSY" and have nothing to read?!?!

BEGIN statement never causes SQLITE_BUSY. As I said, it doesn't touch the database file, doesn't in itself try to acquire any locks, not even SHARED.

Now, when the second thread attempts to read (by issuing SELECT statement), it may or may not get SQLITE_BUSY. This depends on whether the first thread holds a RESERVED lock, or a PENDING or EXCLUSIVE lock. That, in turn, depends on whether the first thread still keeps its pending modifications in an in-memory cache, or has spilled (or is just about to spill) them into the database file on disk.

For more details, see http://sqlite.org/lockingv3.html

Igor Tandetnik

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

Reply via email to