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

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

Issue 18805: Correct sqlite wrapper behavior on systems where wchar_t is UTF-32, (Closed)
Patch Set: minor fixes Created 11 years, 10 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
« no previous file with comments | « chrome/browser/meta_table_helper.cc ('k') | chrome/common/sqlite_utils.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <vector> 9 #include <vector>
10 10
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 "FROM keywords ORDER BY id ASC") != SQLITE_OK) { 534 "FROM keywords ORDER BY id ASC") != SQLITE_OK) {
535 NOTREACHED() << "Statement prepare failed"; 535 NOTREACHED() << "Statement prepare failed";
536 return false; 536 return false;
537 } 537 }
538 int result; 538 int result;
539 while ((result = s.step()) == SQLITE_ROW) { 539 while ((result = s.step()) == SQLITE_ROW) {
540 TemplateURL* template_url = new TemplateURL(); 540 TemplateURL* template_url = new TemplateURL();
541 std::wstring tmp; 541 std::wstring tmp;
542 template_url->set_id(s.column_int64(0)); 542 template_url->set_id(s.column_int64(0));
543 543
544 s.column_string16(1, &tmp); 544 s.column_wstring(1, &tmp);
545 DCHECK(!tmp.empty()); 545 DCHECK(!tmp.empty());
546 template_url->set_short_name(tmp); 546 template_url->set_short_name(tmp);
547 547
548 s.column_string16(2, &tmp); 548 s.column_wstring(2, &tmp);
549 template_url->set_keyword(tmp); 549 template_url->set_keyword(tmp);
550 550
551 s.column_string16(3, &tmp); 551 s.column_wstring(3, &tmp);
552 if (!tmp.empty()) 552 if (!tmp.empty())
553 template_url->SetFavIconURL(GURL(WideToUTF8(tmp))); 553 template_url->SetFavIconURL(GURL(WideToUTF8(tmp)));
554 554
555 s.column_string16(4, &tmp); 555 s.column_wstring(4, &tmp);
556 template_url->SetURL(tmp, 0, 0); 556 template_url->SetURL(tmp, 0, 0);
557 557
558 template_url->set_safe_for_autoreplace(s.column_int(5) == 1); 558 template_url->set_safe_for_autoreplace(s.column_int(5) == 1);
559 559
560 s.column_string16(6, &tmp); 560 s.column_wstring(6, &tmp);
561 if (!tmp.empty()) 561 if (!tmp.empty())
562 template_url->set_originating_url(GURL(WideToUTF8(tmp))); 562 template_url->set_originating_url(GURL(WideToUTF8(tmp)));
563 563
564 template_url->set_date_created(Time::FromTimeT(s.column_int64(7))); 564 template_url->set_date_created(Time::FromTimeT(s.column_int64(7)));
565 565
566 template_url->set_usage_count(s.column_int(8)); 566 template_url->set_usage_count(s.column_int(8));
567 567
568 std::vector<std::string> encodings; 568 std::vector<std::string> encodings;
569 SplitString(s.column_string(9), ';', &encodings); 569 SplitString(s.column_string(9), ';', &encodings);
570 template_url->set_input_encodings(encodings); 570 template_url->set_input_encodings(encodings);
571 571
572 template_url->set_show_in_default_list(s.column_int(10) == 1); 572 template_url->set_show_in_default_list(s.column_int(10) == 1);
573 573
574 s.column_string16(11, &tmp); 574 s.column_wstring(11, &tmp);
575 template_url->SetSuggestionsURL(tmp, 0, 0); 575 template_url->SetSuggestionsURL(tmp, 0, 0);
576 576
577 template_url->set_prepopulate_id(s.column_int(12)); 577 template_url->set_prepopulate_id(s.column_int(12));
578 578
579 template_url->set_autogenerate_keyword(s.column_int(13) == 1); 579 template_url->set_autogenerate_keyword(s.column_int(13) == 1);
580 580
581 urls->push_back(template_url); 581 urls->push_back(template_url);
582 } 582 }
583 return result == SQLITE_DONE; 583 return result == SQLITE_DONE;
584 } 584 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 754 }
755 755
756 static void InitPasswordFormFromStatement(PasswordForm* form, 756 static void InitPasswordFormFromStatement(PasswordForm* form,
757 SQLStatement* s) { 757 SQLStatement* s) {
758 std::string encrypted_password; 758 std::string encrypted_password;
759 std::string tmp; 759 std::string tmp;
760 s->column_string(0, &tmp); 760 s->column_string(0, &tmp);
761 form->origin = GURL(tmp); 761 form->origin = GURL(tmp);
762 s->column_string(1, &tmp); 762 s->column_string(1, &tmp);
763 form->action = GURL(tmp); 763 form->action = GURL(tmp);
764 s->column_string16(2, &form->username_element); 764 s->column_wstring(2, &form->username_element);
765 s->column_string16(3, &form->username_value); 765 s->column_wstring(3, &form->username_value);
766 s->column_string16(4, &form->password_element); 766 s->column_wstring(4, &form->password_element);
767 s->column_blob_as_string(5, &encrypted_password); 767 s->column_blob_as_string(5, &encrypted_password);
768 Encryptor::DecryptWideString(encrypted_password, &form->password_value); 768 Encryptor::DecryptWideString(encrypted_password, &form->password_value);
769 s->column_string16(6, &form->submit_element); 769 s->column_wstring(6, &form->submit_element);
770 s->column_string(7, &tmp); 770 s->column_string(7, &tmp);
771 form->signon_realm = tmp; 771 form->signon_realm = tmp;
772 form->ssl_valid = (s->column_int(8) > 0); 772 form->ssl_valid = (s->column_int(8) > 0);
773 form->preferred = (s->column_int(9) > 0); 773 form->preferred = (s->column_int(9) > 0);
774 form->date_created = Time::FromTimeT(s->column_int64(10)); 774 form->date_created = Time::FromTimeT(s->column_int64(10));
775 form->blacklisted_by_user = (s->column_int(11) > 0); 775 form->blacklisted_by_user = (s->column_int(11) > 0);
776 int scheme_int = s->column_int(12); 776 int scheme_int = s->column_int(12);
777 DCHECK((scheme_int >= 0) && (scheme_int <= PasswordForm::SCHEME_OTHER)); 777 DCHECK((scheme_int >= 0) && (scheme_int <= PasswordForm::SCHEME_OTHER));
778 form->scheme = static_cast<PasswordForm::Scheme>(scheme_int); 778 form->scheme = static_cast<PasswordForm::Scheme>(scheme_int);
779 } 779 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1013
1014 s.bind_wstring(0, name); 1014 s.bind_wstring(0, name);
1015 s.bind_wstring(1, prefix_lower); 1015 s.bind_wstring(1, prefix_lower);
1016 s.bind_wstring(2, next_prefix); 1016 s.bind_wstring(2, next_prefix);
1017 s.bind_int(3, limit); 1017 s.bind_int(3, limit);
1018 } 1018 }
1019 1019
1020 values->clear(); 1020 values->clear();
1021 int result; 1021 int result;
1022 while ((result = s.step()) == SQLITE_ROW) 1022 while ((result = s.step()) == SQLITE_ROW)
1023 values->push_back(s.column_string16(0)); 1023 values->push_back(s.column_wstring(0));
1024 1024
1025 return result == SQLITE_DONE; 1025 return result == SQLITE_DONE;
1026 } 1026 }
1027 1027
1028 bool WebDatabase::RemoveFormElementsAddedBetween(const Time delete_begin, 1028 bool WebDatabase::RemoveFormElementsAddedBetween(const Time delete_begin,
1029 const Time delete_end) { 1029 const Time delete_end) {
1030 SQLStatement s; 1030 SQLStatement s;
1031 if (s.prepare(db_, 1031 if (s.prepare(db_,
1032 "SELECT DISTINCT pair_id FROM autofill_dates WHERE " 1032 "SELECT DISTINCT pair_id FROM autofill_dates WHERE "
1033 "date_created >= ? AND date_created < ?") != SQLITE_OK) { 1033 "date_created >= ? AND date_created < ?") != SQLITE_OK) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 1143
1144 // Add successive versions here. Each should set the version number and 1144 // Add successive versions here. Each should set the version number and
1145 // compatible version number as appropriate, then fall through to the next 1145 // compatible version number as appropriate, then fall through to the next
1146 // case. 1146 // case.
1147 1147
1148 case kCurrentVersionNumber: 1148 case kCurrentVersionNumber:
1149 // No migration needed. 1149 // No migration needed.
1150 return; 1150 return;
1151 } 1151 }
1152 } 1152 }
OLDNEW
« no previous file with comments | « chrome/browser/meta_table_helper.cc ('k') | chrome/common/sqlite_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698