Simon Slavin wrote: > On 2 Jan 2014, at 2:57pm, Yuriy Kaminskiy <yum...@gmail.com> wrote: > >> Simon Slavin wrote: >>> sqlite3_busy_timeout() >> Waiting for timeout *cannot* fix any errors that can trigger failure in >> sqlite3_close. Those are *program logic* errors. > > I am not trying to fix your program logic errors. I am telling you how to > replace the code in your program which doesn't work (the way you handle > SQLITE_BUSY in the code you wrote) with code which does work (SQLite's own > internal way of handling a busy database).
SQLite internal way of handling busy database DOES NOT handle case of "there are unfinalized statement(s) left at the moment of sqlite3_close call" (resulting in SQLITE_BUSY error). SQLite won't even TRY to retry sqlite3_close internally, no matter if busy_timeout was set or not (and this is not a bug; it would be *stupid* waste of time if it would). On other hand, OP's code (attempt to enumerate and finalize all statements and retry close()) *can* help (although, it hides real error [lack of statement finalization] and can result in SIGSEGV/heap corruption if those forcibly-finalized statements will be used anyhow elsewhere). (Besides, it is not "my program", it is OP's program). _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users