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

Side by Side Diff: sql/meta_table.cc

Issue 14976003: Histogram versions and extended error codes for SQLite databases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oops - need old histograms for continuity. Created 7 years, 7 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
« no previous file with comments | « sql/connection.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "sql/meta_table.h" 5 #include "sql/meta_table.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "sql/connection.h" 9 #include "sql/connection.h"
10 #include "sql/statement.h" 10 #include "sql/statement.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 if (!DoesTableExist(db)) { 45 if (!DoesTableExist(db)) {
46 if (!db_->Execute("CREATE TABLE meta" 46 if (!db_->Execute("CREATE TABLE meta"
47 "(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR)")) 47 "(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR)"))
48 return false; 48 return false;
49 49
50 // Note: there is no index over the meta table. We currently only have a 50 // Note: there is no index over the meta table. We currently only have a
51 // couple of keys, so it doesn't matter. If we start storing more stuff in 51 // couple of keys, so it doesn't matter. If we start storing more stuff in
52 // there, we should create an index. 52 // there, we should create an index.
53 SetVersionNumber(version); 53 SetVersionNumber(version);
54 SetCompatibleVersionNumber(compatible_version); 54 SetCompatibleVersionNumber(compatible_version);
55 } else {
56 db_->AddTaggedHistogram("Sqlite.Version", GetVersionNumber());
55 } 57 }
56 return transaction.Commit(); 58 return transaction.Commit();
57 } 59 }
58 60
59 void MetaTable::Reset() { 61 void MetaTable::Reset() {
60 db_ = NULL; 62 db_ = NULL;
61 } 63 }
62 64
63 void MetaTable::SetVersionNumber(int version) { 65 void MetaTable::SetVersionNumber(int version) {
64 DCHECK_GT(version, 0); 66 DCHECK_GT(version, 0);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 146
145 bool MetaTable::PrepareGetStatement(Statement* statement, const char* key) { 147 bool MetaTable::PrepareGetStatement(Statement* statement, const char* key) {
146 DCHECK(db_ && statement); 148 DCHECK(db_ && statement);
147 statement->Assign(db_->GetCachedStatement(SQL_FROM_HERE, 149 statement->Assign(db_->GetCachedStatement(SQL_FROM_HERE,
148 "SELECT value FROM meta WHERE key=?")); 150 "SELECT value FROM meta WHERE key=?"));
149 statement->BindCString(0, key); 151 statement->BindCString(0, key);
150 return statement->Step(); 152 return statement->Step();
151 } 153 }
152 154
153 } // namespace sql 155 } // namespace sql
OLDNEW
« no previous file with comments | « sql/connection.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698