database file is locked even after database::disconnect
andreo-k opened this issue · 1 comments
andreo-k commented
The bug in your code:
int database::disconnect()
{
int rc = SQLITE_OK;
if (db_) {
rc = sqlite3_close(db_);
db_ = 0;
}
return rc;
}
if sqlite3_close returned an error, db_ becomes NULL and database never closed.
Probably, you should add rc check
if (rc == SQLITE_OK)
db_ = 0;