Perhaps you should change your calling sequence so that you call sqlite3_next_stmt() BEFORE sqlite3_close()? If you exclusively use sqlte3_prepare_v2() you can retrieve the text of the unfinalized statement(s), print/log that, and maybe even call sqlite3_finalize() if you like.
-----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:[email protected]] Im Auftrag von Igor Korot Gesendet: Mittwoch, 14. Dezember 2016 01:55 An: Discussion of SQLite Database <[email protected]>; General Discussion of SQLite Database <[email protected]> Betreff: [sqlite] How do I check if the DB is open? 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 ___________________________________________ Gunter Hick Software Engineer Scientific Games International GmbH FN 157284 a, HG Wien Klitschgasse 2-4, A-1130 Vienna, Austria Tel: +43 1 80100 0 E-Mail: [email protected] This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

