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

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

Issue 7232023: Added last_modified field to TemplateURL and database. Updated unit tests, including refactoring ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
« no previous file with comments | « chrome/browser/webdata/keyword_table.h ('k') | chrome/browser/webdata/keyword_table_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/keyword_table.cc
===================================================================
--- chrome/browser/webdata/keyword_table.cc (revision 90021)
+++ chrome/browser/webdata/keyword_table.cc (working copy)
@@ -18,7 +18,7 @@
namespace {
// ID of the url column in keywords.
-const int kUrlIdPosition = 16;
+const int kUrlIdPosition = 17;
// Keys used in the meta table.
const char* kDefaultSearchProviderKey = "Default Search Provider ID";
@@ -54,6 +54,7 @@
s->BindBool(14, url.created_by_policy());
s->BindString(15, url.instant_url() ? url.instant_url()->url() :
std::string());
+ s->BindInt64(16, url.last_modified().ToTimeT());
}
} // anonymous namespace
@@ -78,7 +79,8 @@
"autogenerate_keyword INTEGER DEFAULT 0,"
"logo_id INTEGER DEFAULT 0,"
"created_by_policy INTEGER DEFAULT 0,"
- "instant_url VARCHAR)")) {
+ "instant_url VARCHAR,"
+ "last_modified INTEGER DEFAULT 0)")) {
NOTREACHED();
return false;
}
@@ -99,8 +101,8 @@
"originating_url, date_created, usage_count, input_encodings, "
"show_in_default_list, suggest_url, prepopulate_id, "
"autogenerate_keyword, logo_id, created_by_policy, instant_url, "
- "id) VALUES "
- "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
+ "last_modified, id) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
if (!s) {
NOTREACHED() << "Statement prepare failed";
return false;
@@ -132,7 +134,7 @@
"safe_for_autoreplace, originating_url, date_created, "
"usage_count, input_encodings, show_in_default_list, "
"suggest_url, prepopulate_id, autogenerate_keyword, logo_id, "
- "created_by_policy, instant_url "
+ "created_by_policy, instant_url, last_modified "
"FROM keywords ORDER BY id ASC"));
if (!s) {
NOTREACHED() << "Statement prepare failed";
@@ -183,6 +185,8 @@
template_url->SetInstantURL(s.ColumnString(16), 0, 0);
+ template_url->set_last_modified(Time::FromTimeT(s.ColumnInt64(17)));
+
urls->push_back(template_url);
}
return s.Succeeded();
@@ -197,7 +201,8 @@
"safe_for_autoreplace=?, originating_url=?, date_created=?, "
"usage_count=?, input_encodings=?, show_in_default_list=?, "
"suggest_url=?, prepopulate_id=?, autogenerate_keyword=?, "
- "logo_id=?, created_by_policy=?, instant_url=? WHERE id=?"));
+ "logo_id=?, created_by_policy=?, instant_url=?, last_modified=? "
+ "WHERE id=?"));
if (!s) {
NOTREACHED() << "Statement prepare failed";
return false;
@@ -290,3 +295,8 @@
return true;
}
+
+bool KeywordTable::MigrateToVersion38AddLastModifiedColumn() {
+ return db_->Execute(
+ "ALTER TABLE keywords ADD COLUMN last_modified INTEGER DEFAULT 0");
+}
Property changes on: chrome\browser\webdata\keyword_table.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/webdata/keyword_table.h ('k') | chrome/browser/webdata/keyword_table_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698