On 3/12/15, Barry <smith.barryp at gmail.com> wrote: > On 13 March 2015 at 01:21, Dinu Marina <dinumarina at gmail.com> wrote: > >> You should be also aware of a more common pitfall: unclosed result sets. >> Any lock is held until you read PAST the last row or you call >> stmt_finalize >> (or the equivalent abstraction in your DBAL). Always close select >> statements. > > > Hi Dinu, > > Am I correct in my understanding then that it is not enough to call > sqlite3_reset, I must call sqlite3_finalize after I am done with a > statement? >
One or the other. Call sqlite3_reset() if you intend to reuse prepared statement (run it again). Call sqlite3_finalize() to destroy the prepared statement and release all of its resources back to the system to be reused. Either is sufficient to release any locks held. -- D. Richard Hipp drh at sqlite.org