I'm having difficulty understanding the locking regime in SQLite 3.

I open the same database with 2 processes (sqlite3.exe for instance).
In process 1 I begin a transaction and insert a row.
In process 2 I also begin a transaction and insert a row - this fails on the
insert with an expected "database is locked" error
In process 1 I now do a commit, but this now also fails with "database is
locked" !!

Am I missing something here or is that a little odd ?

I assumed that the first thread to get a WRITE lock would be the controlling
thread and the database would be locked until that thread relinquished the
lock by calling commit or rollback.  How can it be that a writer that has a
change pending is blocked from committing that change by another thread that
hasn't actually attempted a change ?

Steve


Reply via email to