Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions platform/shared/db/DBAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ void CDBAdapter::open (String strDbPath, String strVer, boolean bTemp, boolean c

boolean bExist = CRhoFile::isFileExist(strDbPath.c_str());
int nRes = sqlite3_open(strDbPath.c_str(),&m_dbHandle);

if ( nRes==SQLITE_NOTADB ) {//kill db and try again
LOG(INFO) + "Open DB: DB file exists, but it is either corrupted or encrypted with an unknown key - no way to recover, kill the DB and create it from scratch.";
CRhoFile::deleteFile(strDbPath.c_str());
nRes = sqlite3_open(strDbPath.c_str(),&m_dbHandle);
}

if ( !checkDbError(nRes) )
return;
//TODO: raise exception if error
Expand Down