On 19 Jul 2016, at 5:43pm, Doug Nebeker <ad...@poweradmin.com> wrote:

> Would it be possible for a file scanning process (anti-virus, backup, etc) to 
> grab hold of a database file at just the right moment, momentarily blocking a 
> write or delete, and causing corruption?

It might prevent the program from accessing the file in a way that the program 
interprets as corruption.  It should not actually corrupt the file on disk.  In 
that if you later reopen the file and run

PRAGMA integrity_check

it should not find a problem.

Does that command find a problem with your file ?  Once you have noticed the 
problem are you restoring to an uncorrupt version before continuing use of the 
file ?

> There is a greater chance that this is my bug or environmental than being in 
> SQLite, so I'm looking for anything I can do to decrease these occurrences.

Are you using any PRAGMAs after you open the file or special modes in your open 
command ?

Do you check the result codes returned by all commands run on the file to make 
sure they're SQLITE_OK ?  The command which notices that the file is corrupt is 
run sometime /after/ the command which corrupts it.  It's probably not the 
command which causes the corruption.

When you make changes to the file do you use _exec() or 
_prepare,_step,_finalize ?

Is the database short enough to allow you to run 'PRAGMA integrity_check' 
occasionally (when your app starts or quits ?  At 3am every morning ?) and 
check the result ?

Do not forget that your mention of 'environmental' includes the possibility of 
a faulty hard disk.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to