On 10 Feb 2012, at 3:01pm, Marc L. Allen wrote:

> From my background, I'm used to SQL statements blocking until appropriate 
> locks are acquired.  From what I've seen, it looks like sqlite doesn't block, 
> but returns BUSY, is that correct?

You can set a timeout.  SQLite tries and retries until the timeout expires, 
then it returns _BUSY.

<http://www.sqlite.org/c3ref/busy_timeout.html>

You can set the timeout to a few milliseconds or a few hours.  Both will work.

> If two processes start a BEGIN IMMEDIATE, will one return a BUSY or will it 
> block and wait?

Dependent on whether the database becomes free before the amount of time you 
set in the timeout.

> If it returns BUSY, how does sqlite3_exec() handle it?

It is the sqlite3_exec() routine which will itself return _BUSY.  It's up to 
your application to handle that well.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to