On 30 Jul 2013, at 5:04am, techi eth <techi...@gmail.com> wrote: >> Could be many rows in many tables were corrupted. If SQLite3 knew exactly >> what had >been corrupted it could just go and fix it without even needing >> your help. > > Here i am thinking of getting details about table & infected > row,SQLite3 doesn't need to fix them.Calling Application will understand & > do the required needful to change that part of database. > It might be helpful to get return data structure with infected row > in corresponding table.
Sorry, but the idea that one piece of corruption corresponds to one row of one table doesn't work. Sometimes it's obvious that a block of data in the database was corrupted but there's no way to tell what part of the block was changed. Sometimes the corruption is in the form of a database file cut off at a certain point: a file which was originally 123456 bytes long is suddenly 100000 bytes long. Sometimes schema details near the beginning of the file become corrupt and it's not possible to tell even which tables were in the database or what rows and columns were in each table. Sometimes the corruption occurs purely in indexes: values stored in tables are correct but SQLite malfunctions while trying to find particular values and ranges. The full details of the SQLite file format are widely available ... <http://www.sqlite.org/fileformat.html> and you could write a very thorough program which might pick through a file and try to guess what data could be rescued, asking a user which possibilities are the most plausible at each stage. But it would be a great deal of work. You might be interested in the sqlite-analyzer programs you can find on the SQLite download page which do some of the work involved. The basic message here is that if a database file has been corrupted it's no longer appropriate to use any data from it in a working system. The good news is that corruption of SQLite databases on working hardware is very rare. With literally billions (thanks DRH) of installations of SQLite it has been debugged very thoroughly and incidents of corrupted files are rare. The best ways to corrupt a SQLite database are listed here: <http://www.sqlite.org/howtocorrupt.html> Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users