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

Unified Diff: chrome/browser/webdata/keyword_table.cc

Issue 217613002: Misc. cleanup found while mucking with search engines code: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 9 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/webdata/keyword_table.cc
===================================================================
--- chrome/browser/webdata/keyword_table.cc (revision 259649)
+++ chrome/browser/webdata/keyword_table.cc (working copy)
@@ -246,7 +246,7 @@
std::string query("INSERT INTO keywords (" + GetKeywordColumns() + ") "
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,"
" ?)");
- sql::Statement s(db_->GetUniqueStatement(query.c_str()));
+ sql::Statement s(db_->GetCachedStatement(SQL_FROM_HERE, query.c_str()));
Scott Hess - ex-Googler 2014/03/31 18:09:08 I hate constructed queries with a vengence. That
Peter Kasting 2014/03/31 19:53:56 They may not be executed multiple times on every C
Scott Hess - ex-Googler 2014/03/31 23:52:08 OK. I sometimes/often feel like we need a more ad
Peter Kasting 2014/04/01 00:18:56 Yeah, it would be nice if there was a simple LRU c
BindURLToStatement(data, &s, 0, 1);
return s.Run();
@@ -254,8 +254,8 @@
bool KeywordTable::RemoveKeyword(TemplateURLID id) {
DCHECK(id);
- sql::Statement s(
- db_->GetUniqueStatement("DELETE FROM keywords WHERE id = ?"));
+ sql::Statement s(db_->GetCachedStatement(
+ SQL_FROM_HERE, "DELETE FROM keywords WHERE id = ?"));
s.BindInt64(0, id);
return s.Run();
@@ -283,15 +283,16 @@
bool KeywordTable::UpdateKeyword(const TemplateURLData& data) {
DCHECK(data.id);
- sql::Statement s(db_->GetUniqueStatement("UPDATE keywords SET short_name=?, "
- "keyword=?, favicon_url=?, url=?, safe_for_autoreplace=?, "
- "originating_url=?, date_created=?, usage_count=?, input_encodings=?, "
- "show_in_default_list=?, suggest_url=?, prepopulate_id=?, "
- "created_by_policy=?, instant_url=?, last_modified=?, sync_guid=?, "
- "alternate_urls=?, search_terms_replacement_key=?, image_url=?,"
- "search_url_post_params=?, suggest_url_post_params=?, "
- "instant_url_post_params=?, image_url_post_params=?, new_tab_url=? "
- "WHERE id=?"));
+ sql::Statement s(db_->GetCachedStatement(
+ SQL_FROM_HERE,
+ "UPDATE keywords SET short_name=?, keyword=?, favicon_url=?, url=?, "
+ "safe_for_autoreplace=?, originating_url=?, date_created=?, "
+ "usage_count=?, input_encodings=?, show_in_default_list=?, "
+ "suggest_url=?, prepopulate_id=?, created_by_policy=?, instant_url=?, "
+ "last_modified=?, sync_guid=?, alternate_urls=?, "
+ "search_terms_replacement_key=?, image_url=?, search_url_post_params=?, "
+ "suggest_url_post_params=?, instant_url_post_params=?, "
+ "image_url_post_params=?, new_tab_url=? WHERE id=?"));
BindURLToStatement(data, &s, 24, 0); // "24" binds id() as the last item.
return s.Run();

Powered by Google App Engine
This is Rietveld 408576698