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/meta_table.cc

Issue 8899012: Put debugging assertions into sql::Statement. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oops, Execute() should stay loose. Created 9 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
« no previous file with comments | « sql/meta_table.h ('k') | sql/sqlite_features_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sql/meta_table.cc
diff --git a/sql/meta_table.cc b/sql/meta_table.cc
index c4736ef37f06d300b5e0f47f546e4bc725ea3361..1aef7f603b3bb1da83608bfbc50a47549e8d1202 100644
--- a/sql/meta_table.cc
+++ b/sql/meta_table.cc
@@ -51,8 +51,7 @@ void MetaTable::Reset() {
bool MetaTable::SetValue(const char* key, const std::string& value) {
Statement s;
- if (!PrepareSetStatement(&s, key))
- return false;
+ PrepareSetStatement(&s, key);
s.BindString(1, value);
return s.Run();
}
@@ -68,9 +67,7 @@ bool MetaTable::GetValue(const char* key, std::string* value) {
bool MetaTable::SetValue(const char* key, int value) {
Statement s;
- if (!PrepareSetStatement(&s, key))
- return false;
-
+ PrepareSetStatement(&s, key);
s.BindInt(1, value);
return s.Run();
}
@@ -86,8 +83,7 @@ bool MetaTable::GetValue(const char* key, int* value) {
bool MetaTable::SetValue(const char* key, int64 value) {
Statement s;
- if (!PrepareSetStatement(&s, key))
- return false;
+ PrepareSetStatement(&s, key);
s.BindInt64(1, value);
return s.Run();
}
@@ -123,26 +119,17 @@ int MetaTable::GetCompatibleVersionNumber() {
return version;
}
-bool MetaTable::PrepareSetStatement(Statement* statement, const char* key) {
+void MetaTable::PrepareSetStatement(Statement* statement, const char* key) {
DCHECK(db_ && statement);
statement->Assign(db_->GetCachedStatement(SQL_FROM_HERE,
"INSERT OR REPLACE INTO meta (key,value) VALUES (?,?)"));
- if (!statement->is_valid()) {
- NOTREACHED() << db_->GetErrorMessage();
- return false;
- }
statement->BindCString(0, key);
- return true;
}
bool MetaTable::PrepareGetStatement(Statement* statement, const char* key) {
DCHECK(db_ && statement);
statement->Assign(db_->GetCachedStatement(SQL_FROM_HERE,
"SELECT value FROM meta WHERE key=?"));
- if (!statement->is_valid()) {
- NOTREACHED() << db_->GetErrorMessage();
- return false;
- }
statement->BindCString(0, key);
if (!statement->Step())
return false;
« no previous file with comments | « sql/meta_table.h ('k') | sql/sqlite_features_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698