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

Side by Side Diff: chrome/browser/webdata/keyword_table.cc

Issue 207643002: Create new Autofill tables as part of DB migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/webdata/keyword_table.h ('k') | chrome/browser/webdata/logins_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/webdata/keyword_table.h" 5 #include "chrome/browser/webdata/keyword_table.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 KeywordTable::~KeywordTable() {} 149 KeywordTable::~KeywordTable() {}
150 150
151 KeywordTable* KeywordTable::FromWebDatabase(WebDatabase* db) { 151 KeywordTable* KeywordTable::FromWebDatabase(WebDatabase* db) {
152 return static_cast<KeywordTable*>(db->GetTable(GetKey())); 152 return static_cast<KeywordTable*>(db->GetTable(GetKey()));
153 } 153 }
154 154
155 WebDatabaseTable::TypeKey KeywordTable::GetTypeKey() const { 155 WebDatabaseTable::TypeKey KeywordTable::GetTypeKey() const {
156 return GetKey(); 156 return GetKey();
157 } 157 }
158 158
159 bool KeywordTable::Init(sql::Connection* db, sql::MetaTable* meta_table) { 159 bool KeywordTable::CreateTablesIfNecessary() {
160 WebDatabaseTable::Init(db, meta_table);
161 return db_->DoesTableExist("keywords") || 160 return db_->DoesTableExist("keywords") ||
162 db_->Execute("CREATE TABLE keywords (" 161 db_->Execute("CREATE TABLE keywords ("
163 "id INTEGER PRIMARY KEY," 162 "id INTEGER PRIMARY KEY,"
164 "short_name VARCHAR NOT NULL," 163 "short_name VARCHAR NOT NULL,"
165 "keyword VARCHAR NOT NULL," 164 "keyword VARCHAR NOT NULL,"
166 "favicon_url VARCHAR NOT NULL," 165 "favicon_url VARCHAR NOT NULL,"
167 "url VARCHAR NOT NULL," 166 "url VARCHAR NOT NULL,"
168 "safe_for_autoreplace INTEGER," 167 "safe_for_autoreplace INTEGER,"
169 "originating_url VARCHAR," 168 "originating_url VARCHAR,"
170 "date_created INTEGER DEFAULT 0," 169 "date_created INTEGER DEFAULT 0,"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 } 674 }
676 } 675 }
677 676
678 // Replace the old table with the new one. 677 // Replace the old table with the new one.
679 sql = "DROP TABLE " + name; 678 sql = "DROP TABLE " + name;
680 if (!db_->Execute(sql.c_str())) 679 if (!db_->Execute(sql.c_str()))
681 return false; 680 return false;
682 sql = "ALTER TABLE keywords_temp RENAME TO " + name; 681 sql = "ALTER TABLE keywords_temp RENAME TO " + name;
683 return db_->Execute(sql.c_str()); 682 return db_->Execute(sql.c_str());
684 } 683 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/keyword_table.h ('k') | chrome/browser/webdata/logins_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698