Re: [sqlite] How do I check if the DB is open?

2016-12-14 Thread Jens Alfke
> On Dec 13, 2016, at 8:01 PM, Igor Korot wrote: > > Yes, you are correct. > Do you know how I can write such a code? Just move the code that looks for statements into the " if( res != SQLITE_OK )” block. —Jens ___ sqlite-users

Re: [sqlite] How do I check if the DB is open?

2016-12-14 Thread Hick Gunter
qlite.org> 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

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Dan Kennedy
mber, 2016 17:55 To: Discussion of SQLite Database; General Discussion of SQLite Database Subject: [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 handli

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Igor Korot
Jens, On Tue, Dec 13, 2016 at 8:38 PM, Jens Alfke wrote: > >> On Dec 13, 2016, at 5:33 PM, Simon Slavin wrote: >> >> The only thing you should do if sqlite3_close() doesn’t work is to print an >> error message which includes the value returned.

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Igor Korot
Nathan, On Tue, Dec 13, 2016 at 8:36 PM, Nathan Bossett wrote: > On Tue, Dec 13, 2016 at 08:20:44PM -0500, Igor Korot wrote: >> > 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. >> >>

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Igor Korot
>> -Original Message- >> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] >> On Behalf Of Igor Korot >> Sent: Tuesday, 13 December, 2016 17:55 >> To: Discussion of SQLite Database; General Discussion of SQLite Database >> Subjec

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Igor Korot
Simon, On Tue, Dec 13, 2016 at 8:33 PM, Simon Slavin wrote: > > On 14 Dec 2016, at 1:20am, Igor Korot 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

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Jens Alfke
> On Dec 13, 2016, at 5:33 PM, Simon Slavin wrote: > > 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 ? Igor is

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Nathan Bossett
On Tue, Dec 13, 2016 at 08:20:44PM -0500, Igor Korot wrote: > > 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

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Keith Medcalf
On Behalf Of Igor Korot > Sent: Tuesday, 13 December, 2016 17:55 > To: Discussion of SQLite Database; General Discussion of SQLite Database > Subject: [sqlite] How do I check if the DB is open? > > Hi, ALL, > I'm using following code to check for errors in debug mode: > >

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Simon Slavin
On 14 Dec 2016, at 1:20am, Igor Korot 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

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Igor Korot
Hi, Nathan, On Tue, Dec 13, 2016 at 8:03 PM, Nathan Bossett 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

Re: [sqlite] How do I check if the DB is open?

2016-12-13 Thread Nathan Bossett
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

[sqlite] How do I check if the DB is open?

2016-12-13 Thread Igor Korot
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 =