Hello all,

I'm upgrading from sqlite 2 to 3, and am trying to get a handle
on the new lock states.

Here is my current understanding (by "process" I mean a process
*or* thread that has opened the database):

----------------------------------------------------------------

A database is in the UNLOCKED state if every process holds *no*
lock of any kind on the database.

A database is in the SHARED state if every process holds either
no lock or a SHARED lock.  Processes holding a SHARED lock may
read, but not write, the database.

A database is in the RESERVED state if one of the processes has
a RESERVED lock.  Only *one* process at a time can hold a RESERVED
lock.  The process holding the RESERVED lock intends to write to
the database file by the time its current transaction ends.  Every
other process must hold either no lock or a SHARED lock.  A process
holding no lock can acquire a SHARED lock, but nothing stronger
than that.  Processes holding SHARED locks can continue to read.

A database is in the PENDING state if one of the processes has
a PENDING lock.  Only *one* process at a time can hold a PENDING
lock.  The process holding the PENDING lock intends to write to
the database file as soon as all other processes drop their SHARED
locks.  Every other process must hold either no lock or a SHARED
lock.  A process holding no lock cannot acquire a lock of any kind.
Processes holding SHARED locks can continue to read.

A database is in the EXCLUSIVE state if one of the processes has
an EXCLUSIVE lock.  Only *one* process at a time can hold an EX-
CLUSIVE lock.  The process holding the EXCLUSIVE lock is currently
writing to the database file.  Every other process must hold *no*
lock.  No other process can acquire a lock of any kind.

----------------------------------------------------------------

Do I have this right?

Thanks,
- Richard Klein


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

Reply via email to