| Index: components/search_engines/keyword_table.cc
|
| diff --git a/components/search_engines/keyword_table.cc b/components/search_engines/keyword_table.cc
|
| index 1bbd601da8fef0f9d8de798ac98a657def036458..5f690d66178392e16e71a4e938aa2461826821e0 100644
|
| --- a/components/search_engines/keyword_table.cc
|
| +++ b/components/search_engines/keyword_table.cc
|
| @@ -446,87 +446,3 @@ bool KeywordTable::GetKeywordAsString(TemplateURLID id,
|
| *result = s.ColumnString(0);
|
| return true;
|
| }
|
| -
|
| -bool KeywordTable::MigrateKeywordsTableForVersion45(const std::string& name) {
|
| - // Create a new table without the columns we're dropping.
|
| - if (!db_->Execute("CREATE TABLE keywords_temp ("
|
| - "id INTEGER PRIMARY KEY,"
|
| - "short_name VARCHAR NOT NULL,"
|
| - "keyword VARCHAR NOT NULL,"
|
| - "favicon_url VARCHAR NOT NULL,"
|
| - "url VARCHAR NOT NULL,"
|
| - "safe_for_autoreplace INTEGER,"
|
| - "originating_url VARCHAR,"
|
| - "date_created INTEGER DEFAULT 0,"
|
| - "usage_count INTEGER DEFAULT 0,"
|
| - "input_encodings VARCHAR,"
|
| - "show_in_default_list INTEGER,"
|
| - "suggest_url VARCHAR,"
|
| - "prepopulate_id INTEGER DEFAULT 0,"
|
| - "created_by_policy INTEGER DEFAULT 0,"
|
| - "instant_url VARCHAR,"
|
| - "last_modified INTEGER DEFAULT 0,"
|
| - "sync_guid VARCHAR)"))
|
| - return false;
|
| - std::string sql("INSERT INTO keywords_temp SELECT " +
|
| - ColumnsForVersion(46, false) + " FROM " + name);
|
| - if (!db_->Execute(sql.c_str()))
|
| - return false;
|
| -
|
| - // NOTE: The ORDER BY here ensures that the uniquing process for keywords will
|
| - // happen identically on both the normal and backup tables.
|
| - sql = "SELECT id, keyword, url, autogenerate_keyword FROM " + name +
|
| - " ORDER BY id ASC";
|
| - sql::Statement s(db_->GetUniqueStatement(sql.c_str()));
|
| - base::string16 placeholder_keyword(base::ASCIIToUTF16("dummy"));
|
| - std::set<base::string16> keywords;
|
| - while (s.Step()) {
|
| - base::string16 keyword(s.ColumnString16(1));
|
| - bool generate_keyword = keyword.empty() || s.ColumnBool(3);
|
| - if (generate_keyword)
|
| - keyword = placeholder_keyword;
|
| - TemplateURLData data;
|
| - data.SetKeyword(keyword);
|
| - data.SetURL(s.ColumnString(2));
|
| - TemplateURL turl(data);
|
| - // Don't persist extension keywords to disk. These will get added to the
|
| - // TemplateURLService as the extensions are loaded.
|
| - bool delete_entry = turl.type() == TemplateURL::OMNIBOX_API_EXTENSION;
|
| - if (!delete_entry && generate_keyword) {
|
| - // Explicitly generate keywords for all rows with the autogenerate bit set
|
| - // or where the keyword is empty.
|
| - SearchTermsData terms_data;
|
| - GURL url(turl.GenerateSearchURL(terms_data));
|
| - if (!url.is_valid()) {
|
| - delete_entry = true;
|
| - } else {
|
| - // Ensure autogenerated keywords are unique.
|
| - keyword = TemplateURL::GenerateKeyword(url);
|
| - while (keywords.count(keyword))
|
| - keyword.append(base::ASCIIToUTF16("_"));
|
| - sql::Statement u(db_->GetUniqueStatement(
|
| - "UPDATE keywords_temp SET keyword=? WHERE id=?"));
|
| - u.BindString16(0, keyword);
|
| - u.BindInt64(1, s.ColumnInt64(0));
|
| - if (!u.Run())
|
| - return false;
|
| - }
|
| - }
|
| - if (delete_entry) {
|
| - sql::Statement u(db_->GetUniqueStatement(
|
| - "DELETE FROM keywords_temp WHERE id=?"));
|
| - u.BindInt64(0, s.ColumnInt64(0));
|
| - if (!u.Run())
|
| - return false;
|
| - } else {
|
| - keywords.insert(keyword);
|
| - }
|
| - }
|
| -
|
| - // Replace the old table with the new one.
|
| - sql = "DROP TABLE " + name;
|
| - if (!db_->Execute(sql.c_str()))
|
| - return false;
|
| - sql = "ALTER TABLE keywords_temp RENAME TO " + name;
|
| - return db_->Execute(sql.c_str());
|
| -}
|
|
|