Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: sql/connection.cc

Issue 104593010: AppCache: Run a quick integrity check on the sqlite database when opening. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sql/connection.cc
diff --git a/sql/connection.cc b/sql/connection.cc
index 6e02cd755f56a31342f6291b4ae418303d5781c9..cb3a06a917ad4f93574083dea151310032a83a59 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -1050,9 +1050,10 @@ int Connection::OnSqliteError(int err, sql::Statement *stmt, const char* sql) {
return err;
}
-// TODO(shess): Allow specifying integrity_check versus quick_check.
// TODO(shess): Allow specifying maximum results (default 100 lines).
-bool Connection::IntegrityCheck(std::vector<std::string>* messages) {
+bool Connection::IntegrityCheck(
+ std::vector<std::string>* messages,
+ bool quick) {
messages->clear();
// This has the side effect of setting SQLITE_RecoveryMode, which
@@ -1065,7 +1066,8 @@ bool Connection::IntegrityCheck(std::vector<std::string>* messages) {
bool ret = false;
{
- const char kSql[] = "PRAGMA integrity_check";
+ const char* kSql = quick ?
+ "PRAGMA quick_check" : "PRAGMA integrity_check";
sql::Statement stmt(GetUniqueStatement(kSql));
// The pragma appears to return all results (up to 100 by default)

Powered by Google App Engine
This is Rietveld 408576698