----- Original Message -----
From: "Jonathan H N Chin" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Thursday, August 18, 2005 8:00 AM
Subject: [sqlite] blocking - busy_timeout vs database is locked(5)
[snip]
but I still occasionally get failures:
DBD::SQLite::db do failed: database is locked(5) at dbdimp.c line
403
Am I doing something wrong?
What is the correct way to make accesses block/retry when the
database is busy?
I'm afraid you'll have to write your own internal retry mechanism. The
busy_timeout only works in certain areas when the database is busy. When an
update is in progress however, all attempts to read will return
*immediately* with a failure message. You'll then have to call
sqlite3_reset() to find out what that error message is. If its a
SQLITE_SCHEMA you need to call sqlite3_prepare() again (don't forget to
rebind your parameters if any), and if its a SQLITE_LOCKED then you need to
sleep for some random amount of time and retry -- with hopefully an eventual
timeout mechanism in place.
Robert