Simon,

On Tue, Dec 13, 2016 at 8:33 PM, Simon Slavin <[email protected]> wrote:
>
> On 14 Dec 2016, at 1:20am, Igor Korot <[email protected]> wrote:
>
>> So are you saying that this code should be executed if sqlite3_close()
>> didn't return SQLITE_OK?
>
> Hold on.  Closing the database is a special case.
>
> The only thing you should do if sqlite3_close() doesn’t work is to print an 
> error message which includes the value returned.  Because if you can’t close 
> the database what are you going to do instead ?

That's correct and that's what I am doing.

>
> Presumably if your program is closing the database it’s about to quit.  So 
> just print an error message (and hope the user reports it to you) then have 
> your program quit as it would have done anyway.

Yes, I'm about to quit.
But what I'm saying is I am writing a lot of queries and I may forget
to call sqlite3_finalize() on one of them.
And so in order to find which query (statement) is dangling I'm trying
to put those 3 lines.

Problem is that if everything is good - m_db is invalid and therefore
the next call to access it fails.

The code should work in all cases - on successful close, then the
statement pointer will be NULL and if I forgot to
finalize any statement(s) - then the *query pointer will point to the
non-closed query.

Thank you.

Thank you.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to