What is the default value of sqlite3_busy_timeout?

倾然丶 夕夏残阳落幕 提交于 2021-02-07 12:58:45

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/25319031/what-is-the-default-value-of-sqlite3-busy-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!