On 4/14/19, Lullaby Dayal <lullaby.tec...@gmail.com> wrote: > > For Sqlite database, as per my understanding, implementing pragma > integrity_check won't guarantee all errors to be detected.
Maybe you are confused with "PRAGMA quick_check"? The "PRAGMA integrity_check" takes a little longer, but does a better job. There is very little that will slip past integrity_check. Both of these pragmas only check the meta-data and linkage. If a bit flips in the middle of a data field (perhaps due to a cosmic-ray hit or something) and that field is not indexed, then there is nothing that will detect that change. To verify the data, you can use checksums. The https://www.sqlite.org/src/file/ext/misc/shathree.c extension implements SHA3 hash functions, for example. The CLI uses those hash functions to checksum the data. In the CLI you can type: .selftest --init And that will create a new table named "selftest" that contains checksums for all other tables. Then later to verify those checksums, run just: .selftest You can look at the CLI source code (https://www.sqlite.org/src/artifact?ln=7748-7852&name=c1986496062f9dba) to see how this is implemented, and even copy/paste the CLI source code into your application, if you want. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users