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

Side by Side Diff: chrome/browser/diagnostics/sqlite_diagnostics.cc

Issue 9365030: More SQL statement usage regularization. Back-touch some (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head Created 8 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" 5 #include "chrome/browser/diagnostics/sqlite_diagnostics.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 int errors = 0; 48 int errors = 0;
49 { // This block scopes the lifetime of the db objects. 49 { // This block scopes the lifetime of the db objects.
50 sql::Connection db; 50 sql::Connection db;
51 db.set_exclusive_locking(); 51 db.set_exclusive_locking();
52 if (!db.Open(path)) { 52 if (!db.Open(path)) {
53 RecordFailure(ASCIIToUTF16("Cannot open DB. Possibly corrupted")); 53 RecordFailure(ASCIIToUTF16("Cannot open DB. Possibly corrupted"));
54 return true; 54 return true;
55 } 55 }
56 sql::Statement s(db.GetUniqueStatement("PRAGMA integrity_check;")); 56 sql::Statement s(db.GetUniqueStatement("PRAGMA integrity_check;"));
57 if (!s) { 57 if (!s.is_valid()) {
58 int error = db.GetErrorCode(); 58 int error = db.GetErrorCode();
59 if (SQLITE_BUSY == error) { 59 if (SQLITE_BUSY == error) {
60 RecordFailure(ASCIIToUTF16("DB locked by another process")); 60 RecordFailure(ASCIIToUTF16("DB locked by another process"));
61 } else { 61 } else {
62 string16 str(ASCIIToUTF16("Pragma failed. Error: ")); 62 string16 str(ASCIIToUTF16("Pragma failed. Error: "));
63 str += base::IntToString16(error); 63 str += base::IntToString16(error);
64 RecordFailure(str); 64 RecordFailure(str);
65 } 65 }
66 return false; 66 return false;
67 } 67 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 appcache_db); 159 appcache_db);
160 } 160 }
161 161
162 DiagnosticTest* MakeSqliteWebDatabaseTrackerDbTest() { 162 DiagnosticTest* MakeSqliteWebDatabaseTrackerDbTest() {
163 FilePath databases_dir(webkit_database::kDatabaseDirectoryName); 163 FilePath databases_dir(webkit_database::kDatabaseDirectoryName);
164 FilePath tracker_db = 164 FilePath tracker_db =
165 databases_dir.Append(webkit_database::kTrackerDatabaseFileName); 165 databases_dir.Append(webkit_database::kTrackerDatabaseFileName);
166 return new SqliteIntegrityTest(false, ASCIIToUTF16("DatabaseTracker DB"), 166 return new SqliteIntegrityTest(false, ASCIIToUTF16("DatabaseTracker DB"),
167 tracker_db); 167 tracker_db);
168 } 168 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/network_action_predictor_database.cc ('k') | chrome/browser/history/download_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698