OLD | NEW |
---|---|
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 "components/autofill/browser/webdata/autofill_table.h" | 5 #include "components/autofill/browser/webdata/autofill_table.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 s.BindString16(2, next_prefix); | 456 s.BindString16(2, next_prefix); |
457 s.BindInt(3, limit); | 457 s.BindInt(3, limit); |
458 } | 458 } |
459 | 459 |
460 values->clear(); | 460 values->clear(); |
461 while (s.Step()) | 461 while (s.Step()) |
462 values->push_back(s.ColumnString16(0)); | 462 values->push_back(s.ColumnString16(0)); |
463 return s.Succeeded(); | 463 return s.Succeeded(); |
464 } | 464 } |
465 | 465 |
466 bool AutofillTable::HasFormElements() { | |
467 sql::Statement s(db_->GetUniqueStatement( | |
468 "SELECT COUNT(*) FROM autofill")); | |
469 if (!s.Step()) { | |
470 NOTREACHED(); | |
471 return false; | |
472 } else { | |
Ilya Sherman
2013/04/27 00:05:55
nit: No else stmt after a return stmt, please.
sgurun-gerrit only
2013/04/29 17:55:16
Done.
benm (inactive)
2013/04/29 18:00:03
return s.Step() ? s.ColumnInt(0) > 0 : false;
loo
sgurun-gerrit only
2013/04/29 19:32:39
himm, notreached is used all over this file in sim
| |
473 return s.ColumnInt(0) > 0; | |
474 } | |
475 } | |
476 | |
466 bool AutofillTable::RemoveFormElementsAddedBetween( | 477 bool AutofillTable::RemoveFormElementsAddedBetween( |
467 const Time& delete_begin, | 478 const Time& delete_begin, |
468 const Time& delete_end, | 479 const Time& delete_end, |
469 std::vector<AutofillChange>* changes) { | 480 std::vector<AutofillChange>* changes) { |
470 DCHECK(changes); | 481 DCHECK(changes); |
471 // Query for the pair_id, name, and value of all form elements that | 482 // Query for the pair_id, name, and value of all form elements that |
472 // were used between the given times. | 483 // were used between the given times. |
473 sql::Statement s(db_->GetUniqueStatement( | 484 sql::Statement s(db_->GetUniqueStatement( |
474 "SELECT DISTINCT a.pair_id, a.name, a.value " | 485 "SELECT DISTINCT a.pair_id, a.name, a.value " |
475 "FROM autofill_dates ad JOIN autofill a ON ad.pair_id = a.pair_id " | 486 "FROM autofill_dates ad JOIN autofill a ON ad.pair_id = a.pair_id " |
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2069 // Add origin to credit_cards. | 2080 // Add origin to credit_cards. |
2070 if (!db_->Execute("ALTER TABLE credit_cards " | 2081 if (!db_->Execute("ALTER TABLE credit_cards " |
2071 "ADD COLUMN origin VARCHAR DEFAULT ''")) { | 2082 "ADD COLUMN origin VARCHAR DEFAULT ''")) { |
2072 return false; | 2083 return false; |
2073 } | 2084 } |
2074 | 2085 |
2075 return transaction.Commit(); | 2086 return transaction.Commit(); |
2076 } | 2087 } |
2077 | 2088 |
2078 } // namespace autofill | 2089 } // namespace autofill |
OLD | NEW |