bool CppSQLite3DB::repair(const CString& strDBFileName, const CString& strRetFileName) { try { CString strTempFileName = ::WizGlobal()->GetTempPath() + WizIntToStr(GetTickCount()) + _T(".tmp"); // CppSQLite3DB dbSrc; dbSrc.open(strDBFileName); // if (!dbSrc.dump(strTempFileName)) { throw CppSQLite3Exception(-1, "Failed to dump database!"); } // dbSrc.close(); // if (PathFileExists(strRetFileName)) { DeleteFile(strRetFileName); } // CppSQLite3DB dbDest; dbDest.open(strRetFileName); // if (!dbDest.read(strTempFileName)) { throw CppSQLite3Exception(-1, "Failed to rebuild database form index!"); } // dbDest.close(); // #ifdef Q_OS_WIN32 _flushall(); #endif // return true; } catch (CppSQLite3Exception& e) { TOLOG(e.errorMessage()); return false; } // return false; }