pragma integrity_check throwing exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pragma integrity_check throwing exception

Roberts, Barry (FINTL)
Hi,

Assume I have a database which is "malformed" due to rowid xxx missing from a table index. In the System.Data.SQLite.dll 1.0.80.0 C# driver the following code would return the reason, I would get a list of the rowid problems allowing me to log them.

        private static IEnumerable<string> IntegrityCheck(SQLiteConnection connection)
        {
            using (var command = new SQLiteCommand(connection))
            {
                command.CommandTimeout = 0;
                command.CommandText = "pragma integrity_check";

                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        yield return reader.GetString(0);
                    }
                }
            }
        }

However using a later driver such as 1.0.105.1 the ExecuteReader() call throws an exception saying the database is malformed. That is not very helpful and stops me running the integrity check. If I replace the integrity_check with quick_check it works and returns ok, so access to the file is ok, just some internal indexes are messed up. Is there any way to get the above working in the later drivers?

Kind Regards,
Fugro Intersite.

Barry Roberts.
[hidden email]<mailto:[hidden email]> | www.fugro.com


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users