-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard Klein wrote:
> Writing to the beginning of the file (the first 40 bytes
> or so) corrupts the database so badly that SQLite can't
> even execute the pragma.

The header contains a signature for the file and important meta
information which make the file useless if they are wrong.  See
http://www.sqlite.org/fileformat.html#tocentry_71

> Writing to the middle of the file -- even a large swath
> of garbage -- does undetected by the pragma.

See the documentation for some idea of what the pragma does:
http://www.sqlite.org/pragma.html#debug

SQLite does not checksum its values.  The integrity check pragma is
checking the structural integrity of the file.  If you write garbage
over free pages, or change values in ways that don't compromise the
structural integrity then you won't see any problems.

There has been some debate over how far the integrity checking should
go.  Some people want a quick verification while others are happy for
spotting a byte out of place even if it would take several minutes.

That said, if you are using a system that random corrupts files then
your problems are far larger than SQLite.  How do you deal with other
data being corrupted, or even ensure that the programs you run aren't
messed with?

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkln+98ACgkQmOOfHg372QRDBACfcS9YjywhW21tQ8fzTZ7CQT0b
eJMAn1uCGmm7WwqGfFyaz0RcaYofR1uv
=19QF
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to