Let me explain it better cause i got confused and i am a newbie also.
I open a connection like this
sqlite3 *ppDB;
int dbcon;
dbcon = sqlite3_open(databasename, &ppDB);
/// i do my code i query the database i do some stuff and i close the database
like this
dbcon = sqlite3_close(ppDB);
I want to check after a while if the connection is allready closed or not for
the simple reason not to reopen the database but if is open to run a query or
if it is closed
to reopen the database and then run the query.
so i think the dbcon is the one i have to check not the ppDB :/
it works now maby i didnt understand what ppDB you were reffering to
if(dbcon){
//is open
}else{
//is closed
}
:) thanks though it is tested and runs ok
________________________________________
From: sqlite-users-bounces at mailinglists.sqlite.org <sqlite-users-bounces at
mailinglists.sqlite.org> on behalf of Simon Slavin <[email protected]>
Sent: Tuesday, March 1, 2016 7:01 PM
To: SQLite mailing list
Subject: Re: [sqlite] How to check if connection to main database
is still open or closed before new query ?
On 1 Mar 2016, at 4:59pm, a a <NoCos30 at hotmail.com> wrote:
> the sqlite3_close() <--- needs one argument if i pass sqlite3_close(NULL) it
> actually closes again a closed connection ?
No. If you pass it null it realises that the connection is closed and does
nothing.
Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users