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

Unified Diff: chrome/browser/history/shortcuts_database.cc

Issue 9071014: Database usage adjustment for .../history (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify SQL Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/shortcuts_database.cc
diff --git a/chrome/browser/history/shortcuts_database.cc b/chrome/browser/history/shortcuts_database.cc
index 5b761df0e0f3c39e360ef68cb1b1b1193fd492fa..5bc9dd69e0c57865a1a8255e76cf88c33c02933c 100644
--- a/chrome/browser/history/shortcuts_database.cc
+++ b/chrome/browser/history/shortcuts_database.cc
@@ -65,15 +65,9 @@ bool DeleteShortcut(const char* field_name, const std::string& id,
sql::Statement s(db.GetUniqueStatement(
base::StringPrintf("DELETE FROM %s WHERE %s = ?", kShortcutsDBName,
field_name).c_str()));
- if (!s) {
- NOTREACHED() << "Statement prepare failed";
- return false;
- }
-
s.BindString(0, id);
- if (!s.Run())
- return false;
- return true;
+
+ return s.Run();
}
} // namespace
@@ -116,17 +110,9 @@ bool ShortcutsDatabase::AddShortcut(
" (id, text, url, contents, contents_class, description,"
" description_class, last_access_time, number_of_hits) "
"VALUES (?,?,?,?,?,?,?,?,?)"));
- if (!s) {
- NOTREACHED();
- return false;
- }
BindShortcutToStatement(shortcut, &s);
- if (!s.Run()) {
- NOTREACHED();
- return false;
- }
- return true;
+ return s.Run();
}
bool ShortcutsDatabase::UpdateShortcut(
@@ -137,13 +123,9 @@ bool ShortcutsDatabase::UpdateShortcut(
" description=?, description_class=?, last_access_time=?,"
" number_of_hits=? "
"WHERE id=?"));
- if (!s) {
- NOTREACHED() << "Statement prepare failed";
- return false;
- }
-
BindShortcutToStatement(shortcut, &s);
s.BindString(9, shortcut.id);
+
bool result = s.Run();
DCHECK_GT(db_.GetLastChangeCount(), 0);
return result;
@@ -183,10 +165,10 @@ bool ShortcutsDatabase::LoadShortcuts(
"SELECT id, text, url, contents, contents_class, "
"description, description_class, last_access_time, number_of_hits "
"FROM " kShortcutsDBName));
- if (!s) {
- NOTREACHED() << "Statement prepare failed";
+
+ if (!s.is_valid())
return false;
- }
+
shortcuts->clear();
while (s.Step()) {
shortcuts->insert(std::make_pair(s.ColumnString(0),
« no previous file with comments | « chrome/browser/history/in_memory_url_index_unittest.cc ('k') | chrome/browser/history/starred_url_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698