I have somewhat-related questions. 
1) Using the Tcl binding for SQLite 2.8, how do I even obtain the value to 
know the DB is busy?
2) If I use
 db timeout 2000
 won't the application wait until the db is free to access the db? Do I even 
need to know it was once busy if SQLite waits until it can proceed?
 Thanks from a DB rookie.

 On 8/18/05, Robert Simpson <[EMAIL PROTECTED]> wrote: 
> 
> ----- 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
> 
> 
> 


-- 
Ray Mosley

Reply via email to