[EMAIL PROTECTED] schrieb:
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.
First of all the OS is windows ce 3.0
Did you set "PRAGMA synchronous=OFF"?  If you do, then pulling a
flash card could corrupt it.
No. synchronous is default of sqlite 3
 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)
Well sqlite receives an error for every sqlite3_exec in process_input(struct callback_data *p, FILE *in) of shell.c , the error is printed on the screen,
but it dous not call sqlite3_close()
then you reinsert the flash card and SQLite continues writing and the
later writes get to the flash card -
yes it  continues writing because now the exec does not fail anymore.
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?
Well it gives an error, but is does recover from the error it seems to me. would be interessting to see whta happens on other os's. i will try windows xp later. what does happend if the power supply of a harddisk fails for a few seconds and comes back again?

i think the problem could be that after the first error the sqlite file is not closed and opend again to use the journal file. after a program crash or a system crash this happens "by default" ( because there is no other way).

regards,
gunnar

Reply via email to