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

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

Issue 5849001: Move GUID utils to src/chrome/common. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/web_database.h" 5 #include "chrome/browser/webdata/web_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "app/l10n_util.h" 12 #include "app/l10n_util.h"
13 #include "app/sql/statement.h" 13 #include "app/sql/statement.h"
14 #include "app/sql/transaction.h" 14 #include "app/sql/transaction.h"
15 #include "base/guid.h"
15 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
16 #include "base/string_split.h" 17 #include "base/string_split.h"
17 #include "base/string_util.h" 18 #include "base/string_util.h"
18 #include "base/tuple.h" 19 #include "base/tuple.h"
19 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/autofill/autofill_profile.h" 21 #include "chrome/browser/autofill/autofill_profile.h"
21 #include "chrome/browser/autofill/autofill_type.h" 22 #include "chrome/browser/autofill/autofill_type.h"
22 #include "chrome/browser/autofill/credit_card.h" 23 #include "chrome/browser/autofill/credit_card.h"
23 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" 24 #include "chrome/browser/diagnostics/sqlite_diagnostics.h"
24 #include "chrome/browser/guid.h"
25 #include "chrome/browser/history/history_database.h" 25 #include "chrome/browser/history/history_database.h"
26 #include "chrome/browser/password_manager/encryptor.h" 26 #include "chrome/browser/password_manager/encryptor.h"
27 #include "chrome/browser/search_engines/template_url.h" 27 #include "chrome/browser/search_engines/template_url.h"
28 #include "chrome/browser/webdata/autofill_change.h" 28 #include "chrome/browser/webdata/autofill_change.h"
29 #include "chrome/common/notification_service.h" 29 #include "chrome/common/notification_service.h"
30 #include "gfx/codec/png_codec.h" 30 #include "gfx/codec/png_codec.h"
31 #include "third_party/skia/include/core/SkBitmap.h" 31 #include "third_party/skia/include/core/SkBitmap.h"
32 #include "webkit/glue/form_field.h" 32 #include "webkit/glue/form_field.h"
33 #include "webkit/glue/password_form.h" 33 #include "webkit/glue/password_form.h"
34 34
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // See http://crbug.com/49332. 248 // See http://crbug.com/49332.
249 string16 LimitDataSize(const string16& data) { 249 string16 LimitDataSize(const string16& data) {
250 if (data.size() > kMaxDataLength) 250 if (data.size() > kMaxDataLength)
251 return data.substr(0, kMaxDataLength); 251 return data.substr(0, kMaxDataLength);
252 252
253 return data; 253 return data;
254 } 254 }
255 255
256 void BindAutoFillProfileToStatement(const AutoFillProfile& profile, 256 void BindAutoFillProfileToStatement(const AutoFillProfile& profile,
257 sql::Statement* s) { 257 sql::Statement* s) {
258 DCHECK(guid::IsValidGUID(profile.guid())); 258 DCHECK(base::IsValidGUID(profile.guid()));
259 s->BindString(0, profile.guid()); 259 s->BindString(0, profile.guid());
260 s->BindString16(1, profile.Label()); 260 s->BindString16(1, profile.Label());
261 261
262 string16 text = profile.GetFieldText(AutoFillType(NAME_FIRST)); 262 string16 text = profile.GetFieldText(AutoFillType(NAME_FIRST));
263 s->BindString16(2, LimitDataSize(text)); 263 s->BindString16(2, LimitDataSize(text));
264 text = profile.GetFieldText(AutoFillType(NAME_MIDDLE)); 264 text = profile.GetFieldText(AutoFillType(NAME_MIDDLE));
265 s->BindString16(3, LimitDataSize(text)); 265 s->BindString16(3, LimitDataSize(text));
266 text = profile.GetFieldText(AutoFillType(NAME_LAST)); 266 text = profile.GetFieldText(AutoFillType(NAME_LAST));
267 s->BindString16(4, LimitDataSize(text)); 267 s->BindString16(4, LimitDataSize(text));
268 text = profile.GetFieldText(AutoFillType(EMAIL_ADDRESS)); 268 text = profile.GetFieldText(AutoFillType(EMAIL_ADDRESS));
(...skipping 15 matching lines...) Expand all
284 text = profile.GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER)); 284 text = profile.GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER));
285 s->BindString16(13, LimitDataSize(text)); 285 s->BindString16(13, LimitDataSize(text));
286 text = profile.GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER)); 286 text = profile.GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER));
287 s->BindString16(14, LimitDataSize(text)); 287 s->BindString16(14, LimitDataSize(text));
288 s->BindInt64(15, Time::Now().ToTimeT()); 288 s->BindInt64(15, Time::Now().ToTimeT());
289 } 289 }
290 290
291 AutoFillProfile* AutoFillProfileFromStatement(const sql::Statement& s) { 291 AutoFillProfile* AutoFillProfileFromStatement(const sql::Statement& s) {
292 AutoFillProfile* profile = new AutoFillProfile; 292 AutoFillProfile* profile = new AutoFillProfile;
293 profile->set_guid(s.ColumnString(0)); 293 profile->set_guid(s.ColumnString(0));
294 DCHECK(guid::IsValidGUID(profile->guid())); 294 DCHECK(base::IsValidGUID(profile->guid()));
295 profile->set_label(s.ColumnString16(1)); 295 profile->set_label(s.ColumnString16(1));
296 296
297 profile->SetInfo(AutoFillType(NAME_FIRST), 297 profile->SetInfo(AutoFillType(NAME_FIRST),
298 s.ColumnString16(2)); 298 s.ColumnString16(2));
299 profile->SetInfo(AutoFillType(NAME_MIDDLE), 299 profile->SetInfo(AutoFillType(NAME_MIDDLE),
300 s.ColumnString16(3)); 300 s.ColumnString16(3));
301 profile->SetInfo(AutoFillType(NAME_LAST), 301 profile->SetInfo(AutoFillType(NAME_LAST),
302 s.ColumnString16(4)); 302 s.ColumnString16(4));
303 profile->SetInfo(AutoFillType(EMAIL_ADDRESS), 303 profile->SetInfo(AutoFillType(EMAIL_ADDRESS),
304 s.ColumnString16(5)); 304 s.ColumnString16(5));
(...skipping 15 matching lines...) Expand all
320 s.ColumnString16(13)); 320 s.ColumnString16(13));
321 profile->SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER), 321 profile->SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER),
322 s.ColumnString16(14)); 322 s.ColumnString16(14));
323 // Intentionally skip column 15, which stores the profile's modification date. 323 // Intentionally skip column 15, which stores the profile's modification date.
324 324
325 return profile; 325 return profile;
326 } 326 }
327 327
328 void BindCreditCardToStatement(const CreditCard& credit_card, 328 void BindCreditCardToStatement(const CreditCard& credit_card,
329 sql::Statement* s) { 329 sql::Statement* s) {
330 DCHECK(guid::IsValidGUID(credit_card.guid())); 330 DCHECK(base::IsValidGUID(credit_card.guid()));
331 s->BindString(0, credit_card.guid()); 331 s->BindString(0, credit_card.guid());
332 s->BindString16(1, credit_card.Label()); 332 s->BindString16(1, credit_card.Label());
333 333
334 string16 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NAME)); 334 string16 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NAME));
335 s->BindString16(2, LimitDataSize(text)); 335 s->BindString16(2, LimitDataSize(text));
336 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)); 336 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH));
337 s->BindString16(3, LimitDataSize(text)); 337 s->BindString16(3, LimitDataSize(text));
338 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); 338 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR));
339 s->BindString16(4, LimitDataSize(text)); 339 s->BindString16(4, LimitDataSize(text));
340 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER)); 340 text = credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER));
341 std::string encrypted_data; 341 std::string encrypted_data;
342 Encryptor::EncryptString16(text, &encrypted_data); 342 Encryptor::EncryptString16(text, &encrypted_data);
343 s->BindBlob(5, encrypted_data.data(), 343 s->BindBlob(5, encrypted_data.data(),
344 static_cast<int>(encrypted_data.length())); 344 static_cast<int>(encrypted_data.length()));
345 s->BindInt64(6, Time::Now().ToTimeT()); 345 s->BindInt64(6, Time::Now().ToTimeT());
346 } 346 }
347 347
348 CreditCard* CreditCardFromStatement(const sql::Statement& s) { 348 CreditCard* CreditCardFromStatement(const sql::Statement& s) {
349 CreditCard* credit_card = new CreditCard; 349 CreditCard* credit_card = new CreditCard;
350 350
351 credit_card->set_guid(s.ColumnString(0)); 351 credit_card->set_guid(s.ColumnString(0));
352 DCHECK(guid::IsValidGUID(credit_card->guid())); 352 DCHECK(base::IsValidGUID(credit_card->guid()));
353 credit_card->set_label(s.ColumnString16(1)); 353 credit_card->set_label(s.ColumnString16(1));
354 354
355 credit_card->SetInfo(AutoFillType(CREDIT_CARD_NAME), 355 credit_card->SetInfo(AutoFillType(CREDIT_CARD_NAME),
356 s.ColumnString16(2)); 356 s.ColumnString16(2));
357 credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH), 357 credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_MONTH),
358 s.ColumnString16(3)); 358 s.ColumnString16(3));
359 credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), 359 credit_card->SetInfo(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR),
360 s.ColumnString16(4)); 360 s.ColumnString16(4));
361 int encrypted_number_len = s.ColumnByteLength(5); 361 int encrypted_number_len = s.ColumnByteLength(5);
362 string16 credit_card_number; 362 string16 credit_card_number;
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 if (!s.Step()) 1641 if (!s.Step())
1642 return false; 1642 return false;
1643 1643
1644 *profile = AutoFillProfileFromStatement(s); 1644 *profile = AutoFillProfileFromStatement(s);
1645 1645
1646 return s.Succeeded(); 1646 return s.Succeeded();
1647 } 1647 }
1648 1648
1649 bool WebDatabase::GetAutoFillProfileForGUID(const std::string& guid, 1649 bool WebDatabase::GetAutoFillProfileForGUID(const std::string& guid,
1650 AutoFillProfile** profile) { 1650 AutoFillProfile** profile) {
1651 DCHECK(guid::IsValidGUID(guid)); 1651 DCHECK(base::IsValidGUID(guid));
1652 DCHECK(profile); 1652 DCHECK(profile);
1653 sql::Statement s(db_.GetUniqueStatement( 1653 sql::Statement s(db_.GetUniqueStatement(
1654 "SELECT guid, label, first_name, middle_name, last_name, email, " 1654 "SELECT guid, label, first_name, middle_name, last_name, email, "
1655 "company_name, address_line_1, address_line_2, city, state, zipcode, " 1655 "company_name, address_line_1, address_line_2, city, state, zipcode, "
1656 "country, phone, fax, date_modified " 1656 "country, phone, fax, date_modified "
1657 "FROM autofill_profiles " 1657 "FROM autofill_profiles "
1658 "WHERE guid = ?")); 1658 "WHERE guid = ?"));
1659 if (!s) { 1659 if (!s) {
1660 NOTREACHED() << "Statement prepare failed"; 1660 NOTREACHED() << "Statement prepare failed";
1661 return false; 1661 return false;
(...skipping 23 matching lines...) Expand all
1685 return false; 1685 return false;
1686 } 1686 }
1687 1687
1688 while (s.Step()) 1688 while (s.Step())
1689 profiles->push_back(AutoFillProfileFromStatement(s)); 1689 profiles->push_back(AutoFillProfileFromStatement(s));
1690 1690
1691 return s.Succeeded(); 1691 return s.Succeeded();
1692 } 1692 }
1693 1693
1694 bool WebDatabase::UpdateAutoFillProfile(const AutoFillProfile& profile) { 1694 bool WebDatabase::UpdateAutoFillProfile(const AutoFillProfile& profile) {
1695 DCHECK(guid::IsValidGUID(profile.guid())); 1695 DCHECK(base::IsValidGUID(profile.guid()));
1696 1696
1697 AutoFillProfile* tmp_profile = NULL; 1697 AutoFillProfile* tmp_profile = NULL;
1698 if (!GetAutoFillProfileForGUID(profile.guid(), &tmp_profile)) 1698 if (!GetAutoFillProfileForGUID(profile.guid(), &tmp_profile))
1699 return false; 1699 return false;
1700 1700
1701 // Preserve appropriate modification dates by not updating unchanged profiles. 1701 // Preserve appropriate modification dates by not updating unchanged profiles.
1702 scoped_ptr<AutoFillProfile> old_profile(tmp_profile); 1702 scoped_ptr<AutoFillProfile> old_profile(tmp_profile);
1703 if (*old_profile == profile) 1703 if (*old_profile == profile)
1704 return true; 1704 return true;
1705 1705
(...skipping 10 matching lines...) Expand all
1716 } 1716 }
1717 1717
1718 BindAutoFillProfileToStatement(profile, &s); 1718 BindAutoFillProfileToStatement(profile, &s);
1719 s.BindString(16, profile.guid()); 1719 s.BindString(16, profile.guid());
1720 bool result = s.Run(); 1720 bool result = s.Run();
1721 DCHECK_GT(db_.GetLastChangeCount(), 0); 1721 DCHECK_GT(db_.GetLastChangeCount(), 0);
1722 return result; 1722 return result;
1723 } 1723 }
1724 1724
1725 bool WebDatabase::RemoveAutoFillProfile(const std::string& guid) { 1725 bool WebDatabase::RemoveAutoFillProfile(const std::string& guid) {
1726 DCHECK(guid::IsValidGUID(guid)); 1726 DCHECK(base::IsValidGUID(guid));
1727 sql::Statement s(db_.GetUniqueStatement( 1727 sql::Statement s(db_.GetUniqueStatement(
1728 "DELETE FROM autofill_profiles WHERE guid = ?")); 1728 "DELETE FROM autofill_profiles WHERE guid = ?"));
1729 if (!s) { 1729 if (!s) {
1730 NOTREACHED() << "Statement prepare failed"; 1730 NOTREACHED() << "Statement prepare failed";
1731 return false; 1731 return false;
1732 } 1732 }
1733 1733
1734 s.BindString(0, guid); 1734 s.BindString(0, guid);
1735 return s.Run(); 1735 return s.Run();
1736 } 1736 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 if (!s.Step()) 1774 if (!s.Step())
1775 return false; 1775 return false;
1776 1776
1777 *credit_card = CreditCardFromStatement(s); 1777 *credit_card = CreditCardFromStatement(s);
1778 1778
1779 return s.Succeeded(); 1779 return s.Succeeded();
1780 } 1780 }
1781 1781
1782 bool WebDatabase::GetCreditCardForGUID(const std::string& guid, 1782 bool WebDatabase::GetCreditCardForGUID(const std::string& guid,
1783 CreditCard** credit_card) { 1783 CreditCard** credit_card) {
1784 DCHECK(guid::IsValidGUID(guid)); 1784 DCHECK(base::IsValidGUID(guid));
1785 sql::Statement s(db_.GetUniqueStatement( 1785 sql::Statement s(db_.GetUniqueStatement(
1786 "SELECT guid, label, name_on_card, expiration_month, expiration_year, " 1786 "SELECT guid, label, name_on_card, expiration_month, expiration_year, "
1787 "card_number_encrypted, date_modified " 1787 "card_number_encrypted, date_modified "
1788 "FROM credit_cards " 1788 "FROM credit_cards "
1789 "WHERE guid = ?")); 1789 "WHERE guid = ?"));
1790 if (!s) { 1790 if (!s) {
1791 NOTREACHED() << "Statement prepare failed"; 1791 NOTREACHED() << "Statement prepare failed";
1792 return false; 1792 return false;
1793 } 1793 }
1794 1794
(...skipping 20 matching lines...) Expand all
1815 return false; 1815 return false;
1816 } 1816 }
1817 1817
1818 while (s.Step()) 1818 while (s.Step())
1819 credit_cards->push_back(CreditCardFromStatement(s)); 1819 credit_cards->push_back(CreditCardFromStatement(s));
1820 1820
1821 return s.Succeeded(); 1821 return s.Succeeded();
1822 } 1822 }
1823 1823
1824 bool WebDatabase::UpdateCreditCard(const CreditCard& credit_card) { 1824 bool WebDatabase::UpdateCreditCard(const CreditCard& credit_card) {
1825 DCHECK(guid::IsValidGUID(credit_card.guid())); 1825 DCHECK(base::IsValidGUID(credit_card.guid()));
1826 1826
1827 CreditCard* tmp_credit_card = NULL; 1827 CreditCard* tmp_credit_card = NULL;
1828 if (!GetCreditCardForGUID(credit_card.guid(), &tmp_credit_card)) 1828 if (!GetCreditCardForGUID(credit_card.guid(), &tmp_credit_card))
1829 return false; 1829 return false;
1830 1830
1831 // Preserve appropriate modification dates by not updating unchanged cards. 1831 // Preserve appropriate modification dates by not updating unchanged cards.
1832 scoped_ptr<CreditCard> old_credit_card(tmp_credit_card); 1832 scoped_ptr<CreditCard> old_credit_card(tmp_credit_card);
1833 if (*old_credit_card == credit_card) 1833 if (*old_credit_card == credit_card)
1834 return true; 1834 return true;
1835 1835
1836 sql::Statement s(db_.GetUniqueStatement( 1836 sql::Statement s(db_.GetUniqueStatement(
1837 "UPDATE credit_cards " 1837 "UPDATE credit_cards "
1838 "SET guid=?, label=?, name_on_card=?, expiration_month=?, " 1838 "SET guid=?, label=?, name_on_card=?, expiration_month=?, "
1839 " expiration_year=?, card_number_encrypted=?, date_modified=? " 1839 " expiration_year=?, card_number_encrypted=?, date_modified=? "
1840 "WHERE guid=?")); 1840 "WHERE guid=?"));
1841 if (!s) { 1841 if (!s) {
1842 NOTREACHED() << "Statement prepare failed"; 1842 NOTREACHED() << "Statement prepare failed";
1843 return false; 1843 return false;
1844 } 1844 }
1845 1845
1846 BindCreditCardToStatement(credit_card, &s); 1846 BindCreditCardToStatement(credit_card, &s);
1847 s.BindString(7, credit_card.guid()); 1847 s.BindString(7, credit_card.guid());
1848 bool result = s.Run(); 1848 bool result = s.Run();
1849 DCHECK_GT(db_.GetLastChangeCount(), 0); 1849 DCHECK_GT(db_.GetLastChangeCount(), 0);
1850 return result; 1850 return result;
1851 } 1851 }
1852 1852
1853 bool WebDatabase::RemoveCreditCard(const std::string& guid) { 1853 bool WebDatabase::RemoveCreditCard(const std::string& guid) {
1854 DCHECK(guid::IsValidGUID(guid)); 1854 DCHECK(base::IsValidGUID(guid));
1855 sql::Statement s(db_.GetUniqueStatement( 1855 sql::Statement s(db_.GetUniqueStatement(
1856 "DELETE FROM credit_cards WHERE guid = ?")); 1856 "DELETE FROM credit_cards WHERE guid = ?"));
1857 if (!s) { 1857 if (!s) {
1858 NOTREACHED() << "Statement prepare failed"; 1858 NOTREACHED() << "Statement prepare failed";
1859 return false; 1859 return false;
1860 } 1860 }
1861 1861
1862 s.BindString(0, guid); 1862 s.BindString(0, guid);
1863 return s.Run(); 1863 return s.Run();
1864 } 1864 }
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 2414
2415 while (s.Step()) { 2415 while (s.Step()) {
2416 sql::Statement update_s( 2416 sql::Statement update_s(
2417 db_.GetUniqueStatement("UPDATE autofill_profiles " 2417 db_.GetUniqueStatement("UPDATE autofill_profiles "
2418 "SET guid=? WHERE unique_id=?")); 2418 "SET guid=? WHERE unique_id=?"));
2419 if (!update_s) { 2419 if (!update_s) {
2420 LOG(WARNING) << "Unable to update web database to version 30."; 2420 LOG(WARNING) << "Unable to update web database to version 30.";
2421 NOTREACHED(); 2421 NOTREACHED();
2422 return sql::INIT_FAILURE; 2422 return sql::INIT_FAILURE;
2423 } 2423 }
2424 update_s.BindString(0, guid::GenerateGUID()); 2424 update_s.BindString(0, base::GenerateGUID());
2425 update_s.BindInt(1, s.ColumnInt(0)); 2425 update_s.BindInt(1, s.ColumnInt(0));
2426 2426
2427 if (!update_s.Run()) { 2427 if (!update_s.Run()) {
2428 LOG(WARNING) << "Unable to update web database to version 30."; 2428 LOG(WARNING) << "Unable to update web database to version 30.";
2429 NOTREACHED(); 2429 NOTREACHED();
2430 return sql::INIT_FAILURE; 2430 return sql::INIT_FAILURE;
2431 } 2431 }
2432 } 2432 }
2433 } 2433 }
2434 } 2434 }
(...skipping 22 matching lines...) Expand all
2457 2457
2458 while (s.Step()) { 2458 while (s.Step()) {
2459 sql::Statement update_s( 2459 sql::Statement update_s(
2460 db_.GetUniqueStatement("UPDATE credit_cards " 2460 db_.GetUniqueStatement("UPDATE credit_cards "
2461 "set guid=? WHERE unique_id=?")); 2461 "set guid=? WHERE unique_id=?"));
2462 if (!update_s) { 2462 if (!update_s) {
2463 LOG(WARNING) << "Unable to update web database to version 30."; 2463 LOG(WARNING) << "Unable to update web database to version 30.";
2464 NOTREACHED(); 2464 NOTREACHED();
2465 return sql::INIT_FAILURE; 2465 return sql::INIT_FAILURE;
2466 } 2466 }
2467 update_s.BindString(0, guid::GenerateGUID()); 2467 update_s.BindString(0, base::GenerateGUID());
2468 update_s.BindInt(1, s.ColumnInt(0)); 2468 update_s.BindInt(1, s.ColumnInt(0));
2469 2469
2470 if (!update_s.Run()) { 2470 if (!update_s.Run()) {
2471 LOG(WARNING) << "Unable to update web database to version 30."; 2471 LOG(WARNING) << "Unable to update web database to version 30.";
2472 NOTREACHED(); 2472 NOTREACHED();
2473 return sql::INIT_FAILURE; 2473 return sql::INIT_FAILURE;
2474 } 2474 }
2475 } 2475 }
2476 } 2476 }
2477 } 2477 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 2577
2578 // Add successive versions here. Each should set the version number and 2578 // Add successive versions here. Each should set the version number and
2579 // compatible version number as appropriate, then fall through to the next 2579 // compatible version number as appropriate, then fall through to the next
2580 // case. 2580 // case.
2581 2581
2582 case kCurrentVersionNumber: 2582 case kCurrentVersionNumber:
2583 // No migration needed. 2583 // No migration needed.
2584 return sql::INIT_OK; 2584 return sql::INIT_OK;
2585 } 2585 }
2586 } 2586 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698