On 13 Mar 2015, at 12:17am, 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?

In order to dispose of a statement you can do either sqlite3_reset() or 
sqlite3_finalize().  The common mistake is to do something like this:

SELECT * FROM myTable WHERE rowid = 36

and then not do either _reset() or _finalize() because you know you have asked 
for only one row so you expect SQLite to have done a _finalize() for you.

Simon.

Reply via email to