On 21 Dec 2015, at 5:04am, Andy KU7T <ku7t at ku7t.org> wrote: > How could this be happening? Disk failure, power failure, etc?
Those things seem the most likely in the circumstances but there are some other possibilities: <https://www.sqlite.org/howtocorrupt.html> > How can this be detected at run time (can I do the integrity check at run > time?)? <https://www.sqlite.org/pragma.html#pragma_integrity_check> > The tool was able to fix it, is that also something that is available as an > api? No. And the tool that fixed it might be fixing it in a way you weren't expecting. For instance it might have made the database file uncorrupt by simply throwing away some data. The normal way to rescue a corrupt database is to abuse the VACUUM command or to use the SQLite shell tool to .dump then .read the data. Also it should not be a normal practise to fix database corruption automatically. SQLite is extremely good code and corruption usually indicates something a human needs to put right, usually failing hardware or incorrect programming. Simon.

