Hi Igor,
I used SQLite versio n 3.5.9.
I read the SQLite online document and the suggession that we need to finalize
all the prepare statement associated with database connection before closing
the connection as below
while( (pStmt = sqlite3_next_stmt(pDb, 0))!=0 ){
sqlite3_finalize(pStmt);
}
sqlSt= sqlite3_close(pDb);
but the codes didn't return the syntax for sqlite3_next_stmt. Is
sqlite3_next_stmt is valid command in SQLite 3.5.9
Thanks
JP
----- Original Message ----
From: Igor Tandetnik <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, August 21, 2008 1:52:15 PM
Subject: Re: [sqlite] sqlite3_close
Joanne Pham <[EMAIL PROTECTED]> wrote:
> Is it necessary to call only sqlite3_close(pDb) before open another
> connection. Thanks,
No (though it's not clear why you would want multiple connections open
at the same time). You can open several connections and close them in
any order.
But in your program, you seem to store the database handle in the same
global variable for each openDb call. If you call openDb twice, the
second handle overwrites the first, so now there's no way to call
sqlite3_close on the first handle. Hence the leak. The situation is not
much different from this:
int* p = new int;
p = new int;
delete p;
// the first allocation leaks - the pointer to it is lost.
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users