I've done some tests by modifying the .db file with a hex editor, to
simulate a corrupt database, and it results in a crash. The open() goes ok
but a routine which checks for a table's existence fails. I assume it is
because I messed up the master tables.
I then added some code to check the integrity of the database and bail out
if it's not ok:
if ( sqlite3_exec( g_Db, wxT( "PRAGMA integrity_check;" ), NULL, NULL,
NULL ) != SQLITE_OK )
{
wxGetApp().DisplaySQLiteError();
OnExit();
return false;
}
This detects the problem allright, but doesn't repair it. The error message
I get is: malformed database schema - unrecognized token '#'
How do I repair the database?
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 01, 2006 1:35 PM
Subject: Re: [sqlite] Reading a damaged database file?
Gunnar Roth <[EMAIL PROTECTED]> wrote:
> >
> Well what happens if i write the db to a compact flash card and remove
> it while writing and put it back again?
The database should recover automatically.
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------