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.


> Actually i have tried that on our ce device while importing cvs records 
> with .read command of sqlite.exe
> Afterwards the integrity check failed, but the db could be repaired with 
> the vacuum command.

Did you set "PRAGMA synchronous=OFF"?  If you do, then pulling a
flash card could corrupt it.  It might also corrupt if your OS
ignores the FlushFileBuffers() system call.


> Maybe the db would not have been corrupted, if the .read command had 
> closed the db file on error. so on open the journal file had been used.
> is this right?
> 

You mean if you have a file on a flash card open, and you remove
the card, the file is not closed automatically by your OS?  Really?
I'd say this is an OS problem and not something that SQLite can
work around.

So if SQLite is writing a file on flash and you pull the flash card,
and SQLite does not receive an error but continues writing (under the
obviously false impression that data is making it to the flash device)
then you reinsert the flash card and SQLite continues writing and the
later writes get to the flash card - that will definitely corrupt
the database.  This is the equivalent of the operating system choosing
to ignore some write requests without giving an error.  Is your OS
really doing that?

--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to