Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default value of sqlite3_busy_timeout?

This seems like it should be really easy to find out, but I don't see it documented anywhere. If I open a sqlite connection and begin a transaction without specifying a timeout by calling sqlite3_busy_timeout, what default value is used? Or will this somehow cause undefined behavior? The documentation of this method doesn't say.

My specific use case is the version bundled with iOS, but I'm guessing the answer is pretty much the same across platforms.

like image 729
Tom Hamming Avatar asked Aug 14 '14 23:08

Tom Hamming


1 Answers

If neither sqlite3_busy_timeout() nor sqlite3_busy_handler() are set and a writer is active then step() returns SQLITE_BUSY immediately.

Note: In some cases SQLITE_IOERR_BLOCKED is returned See also: Register A Callback To Handle SQLITE_BUSY Errors in the second paragraph where it states

If the busy callback is NULL, then SQLITE_BUSY or SQLITE_IOERR_BLOCKED is returned immediately upon encountering the lock. If the busy callback is not NULL, then the callback might be invoked with two arguments.

like image 65
dtrotzjr Avatar answered Nov 15 '22 08:11

dtrotzjr