Hi, Nathan,
On Tue, Dec 13, 2016 at 8:03 PM, Nathan Bossett <[email protected]> wrote:
> I'm not sure exactly what you're trying to do, but if sqlite3_close()
> returns SQLITE_OK then it closed and if it returns SQLITE_BUSY then it's
> not closed but possibly in a messy state (my selects have default handling
> too but I think those are the only defined responses). If you know it
> closed, then set a flag (or vice versa).
>
> What more are you trying to find out?
If I forget to finalize statement, I can use that sequence to find
which query is dangling.
So are you saying that this code should be executed if sqlite3_close()
didn't return SQLITE_OK?
Thank you.
>
> -Nathan
>
> On Tue, Dec 13, 2016 at 07:54:34PM -0500, Igor Korot wrote:
>> Hi, ALL,
>> I'm using following code to check for errors in debug mode:
>>
>> int res = sqlite3_close( m_db );
>> if( res != SQLITE_OK )
>> {
>> // error handling
>> }
>> #ifdef DEBUG
>> sqlite3_stmt *statement = sqlite3_next_stmt( m_db, NULL );
>> if( statement )
>> const char *query = sqlite3_sql( statement );
>> #endif
>>
>> However the call to sqlite3_close() make the 'm_db' pointer invalid if
>> everything is successful and hence the sqlite3_next_stmt() crashes.
>>
>> How do I properly check if the DB is still open?
>> Or maybe I should put the code inside #ifdef....#endif before DB closing?
>>
>> Thank you.
>> _______________________________________________
>> 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
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users