Hello,
I used this minimal example code to test my sqlite connection. This
works without problems. But now I tried to move the 'db' variable into
the private member section of my 'Cache' class to access it from
various member functions. That's all. I would assume that this makes no
difference. But my app crash at sqlite3_open().
bool Cache::isUrlCached (const string &url, string &outFilename)
{
sqlite3 *db; // moved into private member of Cache
char *zErrMsg = 0;
int rc;
string dbName ("../data/cache.db");
string query ("SELECT url FROM cache");
rc = sqlite3_open(dbName.c_str (), &db); // -> crash
if( rc )
{
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
rc = sqlite3_exec(db, query.c_str (), callback, 0, &zErrMsg);
if( rc!=SQLITE_OK )
{
fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
}
sqlite3_close(db);
}
Any ideas why this happens and how to prevent it?
regards
Andreas
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------