diff options
Diffstat (limited to 'chromium/components/search_engines/keyword_table.cc')
-rw-r--r-- | chromium/components/search_engines/keyword_table.cc | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/chromium/components/search_engines/keyword_table.cc b/chromium/components/search_engines/keyword_table.cc index 8278864b0f0..3feaad1eac4 100644 --- a/chromium/components/search_engines/keyword_table.cc +++ b/chromium/components/search_engines/keyword_table.cc @@ -99,6 +99,10 @@ const std::string ColumnsForVersion(int version, bool concatenated) { // Column added in version 69. columns.push_back("last_visited"); } + if (version >= 82) { + // Column added in version 82. + columns.push_back("created_from_play_api"); + } return base::JoinString(columns, std::string(concatenated ? " || " : ", ")); } @@ -151,6 +155,7 @@ void BindURLToStatement(const TemplateURLData& data, s->BindString(starting_column + 19, data.new_tab_url); s->BindInt64(starting_column + 20, data.last_visited.since_origin().InMicroseconds()); + s->BindBool(starting_column + 21, data.created_from_play_api); } WebDatabaseTable::TypeKey GetKey() { @@ -200,7 +205,8 @@ bool KeywordTable::CreateTablesIfNecessary() { "suggest_url_post_params VARCHAR," "image_url_post_params VARCHAR," "new_tab_url VARCHAR," - "last_visited INTEGER DEFAULT 0)"); + "last_visited INTEGER DEFAULT 0, " + "created_from_play_api INTEGER DEFAULT 0)"); } bool KeywordTable::IsSyncable() { @@ -228,6 +234,8 @@ bool KeywordTable::MigrateToVersion(int version, case 77: *update_compatible_version = true; return MigrateToVersion77IncreaseTimePrecision(); + case 82: + return MigrateToVersion82AddCreatedFromPlayApiColumn(); } return true; @@ -436,6 +444,12 @@ bool KeywordTable::MigrateToVersion77IncreaseTimePrecision() { return transaction.Commit(); } +bool KeywordTable::MigrateToVersion82AddCreatedFromPlayApiColumn() { + return db_->Execute( + "ALTER TABLE keywords ADD COLUMN created_from_play_api INTEGER DEFAULT " + "0"); +} + // static bool KeywordTable::GetKeywordDataFromStatement(const sql::Statement& s, TemplateURLData* data) { @@ -467,6 +481,7 @@ bool KeywordTable::GetKeywordDataFromStatement(const sql::Statement& s, data->last_modified = base::Time() + base::TimeDelta::FromMicroseconds(s.ColumnInt64(13)); data->created_by_policy = s.ColumnBool(12); + data->created_from_play_api = s.ColumnBool(22); data->usage_count = s.ColumnInt(8); data->prepopulate_id = s.ColumnInt(11); data->sync_guid = s.ColumnString(14); @@ -494,7 +509,7 @@ bool KeywordTable::AddKeyword(const TemplateURLData& data) { DCHECK(data.id); std::string query("INSERT INTO keywords (" + GetKeywordColumns() + ") " - "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); sql::Statement s(db_->GetCachedStatement(SQL_FROM_HERE, query.c_str())); BindURLToStatement(data, &s, 0, 1); @@ -519,8 +534,9 @@ bool KeywordTable::UpdateKeyword(const TemplateURLData& data) { "usage_count=?, input_encodings=?, suggest_url=?, prepopulate_id=?, " "created_by_policy=?, last_modified=?, sync_guid=?, alternate_urls=?, " "image_url=?, search_url_post_params=?, suggest_url_post_params=?, " - "image_url_post_params=?, new_tab_url=?, last_visited=? WHERE id=?")); - BindURLToStatement(data, &s, 21, 0); // "21" binds id() as the last item. + "image_url_post_params=?, new_tab_url=?, last_visited=?, " + "created_from_play_api=? WHERE id=?")); + BindURLToStatement(data, &s, 22, 0); // "22" binds id() as the last item. return s.Run(); } |