SQLite databases are protected like a big reader-writer lock: there is
no way read while you are writing.  "BEGIN IMMEDIATE" simply changes
when it takes the write lock, and won't affect this.

On 9/15/06, Liam Healy <[EMAIL PROTECTED]> wrote:
I have a database that has one writer which runs once a day, and
potentially many readers running whenever someone wants some
information.  I am trying to understand concurrency in sqlite3 so that
I can have the writer run each day, regardless of whether a reader is
already running or a reader starts up after the writer is running.  I
am referring to the documentation
http://www.sqlite.org/lang_transaction.html and
http://sqlite.org/lockingv3.html but I can't quite figure out how to
do this.

I understand from lang_transaction that if the writer starts with
BEGIN IMMEDIATE
and ends with
END
then it will be possible for readers to read the database while the
writer is updating it: "After a BEGIN IMMEDIATE, you are guaranteed
that no other thread or process will be able to write to the database
or do a BEGIN IMMEDIATE or BEGIN EXCLUSIVE. Other processes can
continue to read from the database, however."
Yet when I try to start up the reader and open the database while the
writer is running, I get SQLITE_BUSY.

Any advice on how to have the reader and writer work without
interfering with each other (the reader is only trying to read old
data, not what the writer is inserting) would be appreciated.

Thank you.

Liam

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




--
Cory Nelson
http://www.int64.org

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

Reply via email to