We are using LinqConnect with SQLite in our silverlight application. It works well. But our application has multiple threads which read from/write to the same database.
Recently one of our clients complained that none of their data is getting saved. On checking, we found that SQLite was throwing the Exception 'The disk image is malformed'.
Upon encountering this error, we checked the integrity (PRAGMA INTEGRITY_CONSTRAINT;) in databases of other clients. Most of the databases are showing some issues - examples:
Code: Select all
sqlite> pragma integrity_check;
wrong # of entries in index sqlite_autoindex_PendingInternetSyncPosts_1
sqlite> pragma integrity_check;
in database main
Main freelist: 1 of 1 pages missing from overflow list starting at 0
Page 5548 is never used
Page 5558 is never used
Page 5719 is never used
Page 5769 is never used
Page 5893 is never used
rowid 5201 missing from index sqlite_autoindex_PatientPayment_1
rowid 5202 missing from index sqlite_autoindex_PatientPayment_1
rowid 5203 missing from index sqlite_autoindex_PatientPayment_1
I need to implement a solution to fix this. In order to do that, I am trying to understand why are such errors occurring.
1) Is this because of the multithreaded access to database?
2) If so, I checked on SQLIte's website, that if the library is built with the SQLITE THREADSAFE macro, it will be thread safe (https://www.sqlite.org/threadsafe.html). So, does LinqConnect build the SQLIte library with this macro? If not, how do I do this?
Thanks,
Mridula.