The database disk image is malformed sqlite
I have migrated my .net 2.0 projects to .net 4.0. With this I had to upgrade system.data.sqlite libraries to the latest versions available 1.0.81.
Right now when I try to query large tables using select * from table I get The database disk image is malformed error. This only happens on tables with lots of records, small tables return records.
Please note if I go back to .net 2.0 and system.data.sqlite 1.0.66 the same DB file works perfecly.
i done some tests and found out that actually its just a little operation that resolves it.
- open db with any software
- remove db password
- save db
- open db
- set password again
hope this helps any body that is stuck with same problem.
Also encountered a similar problem recently. Even after updating all AColumn values in ATable table to a new value e.g 2 using the following query
UPDATE ATable SET AColumn = 2;
the following select distinct query
SELECT DISTINCT AColumn from ATable;
returned old values e.g. 1,2,3, and
SELECT * FROM ATable WHERE AColumn = 1
resulted in a "The database disk image is malformed sqlite" error.
ATable had an index on AColumn and all the queries going through that index returned wrong result. Running integrity check using the following PRAGMA proved that some indexes were corrupt.
IDX_AColumn was missing a lot of rows and the index also contained wrong number of entries. Luckily data in all the tables was intact, only a few indexes were corrupt. Reindexing the corrupt indexes solved problem.
REINDEX ATable; http://www.sqlite.org/lang_reindex.html
If a lot of indexes are corrupt you can reindex all of then at the same time using command: