Sometimes my iOS app creates an unreasonable number of prepared statements 
(perhaps 1,000, an app bug that I'm fixing).  These prepared statements are 
later finalized just prior to doing sqlite3_close(), which sometimes returns 
SQL_BUSY.  The docs say SQL_BUSY will be returned if I haven't finalized all 
prepared statements, but I believe I have done so.  My iOS app has only one 
connection to the DB and I'm doing all this work on the main thread.

1.  The docs don't say what to do in the case of SQL_BUSY.  Does that mean I've 
certainly failed to finalize one or more prepared statements, or does SQLite 
just need more time (in which case can I loop on sqlite3_close() until I get 
SQLITE_OK)?

2.  Does SQLite keep a record of prepared statements?  If so, is there a way I 
can ask SQLite to close them all, or are there any tricks to debugging which 
statements have not been finalized?

Jeff

Reply via email to