Dima Dat'ko wrote:

> Sorry for the long introduction. Here is the question. Am I right
> there is no option defined to have the stmtjrnl file in memory or in
> some specified path other then the same folder as the db? It's
> critical to prevent the db corruption in all kinds of software and
> hardware fails. If I manage stmtjrnl file to be created in memory
> instead of the slow flash card and the file disappear after a power
> brake on the device will it result in unrecoverable corruption of the
> data in the db?
> 

You are correct. SQLite requires the journal file to exist in the same 
directory as the database file itself. In memory databases don't have 
journal files at all.

> Any other advice for my problem?
> 

You could make a customized version of SQLite that keeps the journal at 
some other location. It would need to check that other location on 
startup, so that it can restore the database file using the journal 
entries in case there is a hot journal file left after a crash.

Whatever process opens the database after a crash must have access to 
both the database file and the journal to do this restoration and avoid 
database corruption. This is why they are stored in the same directory 
by default. If there is a possibility of the user removing the flash 
card after a crash, and inserting it into the PC to open the database, 
then the journal must be on the flash card to do the rollback. If it 
must be on the flash card, it might as well be in the same directory.

If you don't store the journal on the falsh card, your custom SQLite 
would have to have a mechanism to open the database and thereby rollback 
any uncommitted changes to ensure that the database is valid. The users 
must do this before removing the flash card with the database from the 
device.

I would suggest using a modified SQLite only as a last resort.

HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to