I make a database, create a table and insert some data.
And then delete a section of data manually using binary editor, result that I can’t get any of column but SQLite does not give me a error message.
console log before db file corrupted:
sqlite .open test.db
sqlite select * from testtable;
> Why it does not show error, some thing like“Error: database disk image is
> malformed”? Is it a bug in SQLite?
because you didn't corrupt a part it actually read. Imagine if you have a
20GB db and you expect it to report such errors when you open the db. It
would have to read the whole db to figure that out, slowing sqlite to a
crawl. Since most dbs are not corrupt, it would be slowest for the average
case and faster for the error case (since it must stop reading on the first
> On Wed, Dec 2, 2015 at 11:59 AM, sanhua.zh <[hidden email]> wrote:
>> Why it does not show error, some thing like“Error: database disk image is
>> malformed”? Is it a bug in SQLite?
> because you didn't corrupt a part it actually read.
Looking at the transcription of the sqlite3.exe sessions included in the post, it would appear that the corruption did change the result. Therefore the corruption was in a part it actually read.
I guess so too.
But, It can be happen in real scene.
A part of data may be lost by a low chance accident in the application lifecycle. It would be very hard to find out this problem and fix it because of causing no error.
发件人:Simon [hidden email] 收件人:SQLite mailing [hidden email] 发送时间:2015年12月2日(周三) 19:42
主题:Re: [sqlite] Why Corrupted DB File Cause No Error?