On Tue, Oct 19, 2004 at 11:58:48AM -0700, Kevin Schmeichel wrote: > > Really, what I was concerned about was getting > SQLITE_BUSY from sqlite_finalize - if I try and call > sqlite_finalize again, I get SQLITE_MISUSE. I haven't > gone through the code in enough detail to determine > what the effects of an incomplete sqlite_finalize > might be (possible memory leaks?).
This confused me as well, but the documentation can clear things up: The sqlite3_finalize() function is called to delete a prepared SQL statement obtained by a previous call to sqlite3_prepare() or sqlite3_prepare16(). If the statement was executed successfully, or not executed at all, then SQLITE_OK is returned. If execution of the statement failed then an error code is returned. So if your sqlite3_step() resulted in SQLITE_BUSY, sqlite3_finalize() will also return SQLITE_BUSY. sqlite3_reset() behaves the same way, although the expected return values are not documented. Cheers, Matt