Hi All,
I have a question related toSQLite db handle(pDb in my codes).
I have the function below to open the database connection. I have to call
sqlite3_close(sqlite3 *)(sqlite3_close(pDb) in my case)
before open another database connection( by calling openDb) for releasing the
memory which is used by previous sqlite3_open_v2(openDb). Otherwise the
protential memory leak will be in the codes.
Your response is greatly appreciated.
JP
MonDb::openDb(const char *dbName){
int sqlSt;
const char* errMsg;
strcpy(name, dbName); //copy database name to the private name field
sqlSt = sqlite3_open_v2( name, &pDb, SQLITE_OPEN_READWRITE |
SQLITE_OPEN_CREATE, 0);
if(sqlSt != SQLITE_OK){
errMsg = sqlite3_errmsg(pDb);
// print out the error message
sqlite3_free((char*) errMsg);
return false;
}
/* Set database properties for better performance */
setDbProperties();
return true;
}
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users