Joe Halpin wrote:
One of the return values from sqlite3_close() is SQLITE_BUSY. The
examples I've seen so far all exit after calling this function and
don't check the return value. I need to be able to close and reopen
the database without exiting, but I'm not sure what to do if I get
SQLITE_BUSY as the return from sqlite3_close().

Should I wait and try again until I get SQLITE_OK or SQLITE_ERROR?

sqlite3_close only returns SQLITE_BUSY if you still have prepared statements against the db handle. You need to finalize all statements before you can close the database. If you get this error, there is a logical bug in your program that you need to fix. In any case, just retrying sqlite3_close is pointless - those statements won't magically finalize themselves so you would just get the same error over and over.

Igor Tandetnik

Reply via email to