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

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

Issue 7396024: Adding a sync_guid field to TemplateURL. Adding appropriate database migration changes and tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Lint fix. Created 9 years, 5 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/web_database.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 92870)
+++ chrome/browser/webdata/keyword_table.cc (working copy)
@@ -18,7 +18,7 @@
namespace {
// ID of the url column in keywords.
-const int kUrlIdPosition = 17;
+const int kUrlIdPosition = 18;
// Keys used in the meta table.
const char* kDefaultSearchProviderKey = "Default Search Provider ID";
@@ -55,6 +55,7 @@
s->BindString(15, url.instant_url() ? url.instant_url()->url() :
std::string());
s->BindInt64(16, url.last_modified().ToTimeT());
+ s->BindString(17, url.sync_guid());
}
} // anonymous namespace
@@ -80,7 +81,8 @@
"logo_id INTEGER DEFAULT 0,"
"created_by_policy INTEGER DEFAULT 0,"
"instant_url VARCHAR,"
- "last_modified INTEGER DEFAULT 0)")) {
+ "last_modified INTEGER DEFAULT 0,"
+ "sync_guid VARCHAR)")) {
NOTREACHED();
return false;
}
@@ -101,8 +103,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, "
- "last_modified, id) VALUES "
- "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
+ "last_modified, sync_guid, id) VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
if (!s) {
NOTREACHED() << "Statement prepare failed";
return false;
@@ -134,7 +136,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, last_modified "
+ "created_by_policy, instant_url, last_modified, sync_guid "
"FROM keywords ORDER BY id ASC"));
if (!s) {
NOTREACHED() << "Statement prepare failed";
@@ -187,6 +189,8 @@
template_url->set_last_modified(Time::FromTimeT(s.ColumnInt64(17)));
+ template_url->set_sync_guid(s.ColumnString(18));
+
urls->push_back(template_url);
}
return s.Succeeded();
@@ -201,8 +205,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=?, last_modified=? "
- "WHERE id=?"));
+ "logo_id=?, created_by_policy=?, instant_url=?, last_modified=?, "
+ "sync_guid=? WHERE id=?"));
if (!s) {
NOTREACHED() << "Statement prepare failed";
return false;
@@ -301,3 +305,8 @@
return db_->Execute(
"ALTER TABLE keywords ADD COLUMN last_modified INTEGER DEFAULT 0");
}
+
+bool KeywordTable::MigrateToVersion39AddSyncGUIDColumn() {
+ return db_->Execute(
+ "ALTER TABLE keywords ADD COLUMN sync_guid VARCHAR");
+}
« no previous file with comments | « chrome/browser/webdata/keyword_table.h ('k') | chrome/browser/webdata/web_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698