Chromium Code Reviews| Index: chrome/browser/webdata/web_intents_table.cc |
| diff --git a/chrome/browser/webdata/web_intents_table.cc b/chrome/browser/webdata/web_intents_table.cc |
| index 90243112e2be6be5d6af888d6ce11148eecaa703..d68e29a8fdf0c4808eaf809cfac4fb82b745bc05 100644 |
| --- a/chrome/browser/webdata/web_intents_table.cc |
| +++ b/chrome/browser/webdata/web_intents_table.cc |
| @@ -90,8 +90,16 @@ bool WebIntentsTable::Init() { |
| if (!db_->Execute("CREATE INDEX IF NOT EXISTS web_intents_default_index" |
| " ON web_intents_defaults (scheme)")) |
| return false; |
| + } else { |
| + // For a while, 'scheme' was set to null when setting a web_intents_defaults |
| + // row. Due to a longstanding SQLite bug, a NULL entry in a unique key field |
| + // is always considered distinct from any other NULL entry in that field, |
| + // rendering the uniqueness obsolete. Get rid of any such entries. |
| + if (!db_->Execute("DELETE FROM web_intents_defaults WHERE scheme IS NULL")) |
|
Steve McKay
2012/09/14 18:57:00
This'll ding startup time. We can do this one and
Greg Billock
2012/09/14 19:12:28
Scott, should we roll DB versions for this?
Scott Hess - ex-Googler
2012/09/14 19:37:47
The UNIQUE constraint will be enforced by a tree k
|
| + return false; |
| } |
| + |
| return true; |
| } |
| @@ -300,14 +308,16 @@ bool WebIntentsTable::SetDefaultService( |
| const DefaultWebIntentService& default_service) { |
| sql::Statement s(db_->GetUniqueStatement( |
| "INSERT OR REPLACE INTO web_intents_defaults " |
| - "(action, type, url_pattern, user_date, suppression, service_url) " |
| - "VALUES (?, ?, ?, ?, ?, ?)")); |
| + "(action, type, url_pattern, user_date, suppression," |
| + " service_url, scheme) " |
| + "VALUES (?, ?, ?, ?, ?, ?, ?)")); |
| s.BindString16(0, default_service.action); |
| s.BindString16(1, default_service.type); |
| s.BindString(2, default_service.url_pattern.GetAsString()); |
| s.BindInt(3, default_service.user_date); |
| s.BindInt64(4, default_service.suppression); |
| s.BindString(5, default_service.service_url); |
| + s.BindString16(6, default_service.scheme); |
| return s.Run(); |
| } |