Open the database as follows:
std::string filename("mydatabase.db"); sqlite3 *db; int rc = sqlite3_open_v2(filename.c_str(), &db, SQLITE_OPEN_READWRITE, NULL);
Then it will return an error code (14) if the database file does not exist. However, if the file exists but is not a valid database, it returns SQLITE_OK
!
source share