| 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 "chrome/browser/history/visit_database.h" | 5 #include "chrome/browser/history/visit_database.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 visit->visit_time = base::Time::FromInternalValue(statement.ColumnInt64(2)); | 99 visit->visit_time = base::Time::FromInternalValue(statement.ColumnInt64(2)); |
| 100 visit->referring_visit = statement.ColumnInt64(3); | 100 visit->referring_visit = statement.ColumnInt64(3); |
| 101 visit->transition = content::PageTransitionFromInt(statement.ColumnInt(4)); | 101 visit->transition = content::PageTransitionFromInt(statement.ColumnInt(4)); |
| 102 visit->segment_id = statement.ColumnInt64(5); | 102 visit->segment_id = statement.ColumnInt64(5); |
| 103 visit->is_indexed = !!statement.ColumnInt(6); | 103 visit->is_indexed = !!statement.ColumnInt(6); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // static | 106 // static |
| 107 bool VisitDatabase::FillVisitVector(sql::Statement& statement, | 107 bool VisitDatabase::FillVisitVector(sql::Statement& statement, |
| 108 VisitVector* visits) { | 108 VisitVector* visits) { |
| 109 if (!statement.is_valid()) |
| 110 return false; |
| 111 |
| 109 while (statement.Step()) { | 112 while (statement.Step()) { |
| 110 history::VisitRow visit; | 113 history::VisitRow visit; |
| 111 FillVisitRow(statement, &visit); | 114 FillVisitRow(statement, &visit); |
| 112 visits->push_back(visit); | 115 visits->push_back(visit); |
| 113 } | 116 } |
| 114 | 117 |
| 115 return statement.Succeeded(); | 118 return statement.Succeeded(); |
| 116 } | 119 } |
| 117 | 120 |
| 118 VisitID VisitDatabase::AddVisit(VisitRow* visit, VisitSource source) { | 121 VisitID VisitDatabase::AddVisit(VisitRow* visit, VisitSource source) { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // Get the source entries out of the query result. | 506 // Get the source entries out of the query result. |
| 504 while (statement.Step()) { | 507 while (statement.Step()) { |
| 505 std::pair<VisitID, VisitSource> source_entry(statement.ColumnInt64(0), | 508 std::pair<VisitID, VisitSource> source_entry(statement.ColumnInt64(0), |
| 506 static_cast<VisitSource>(statement.ColumnInt(1))); | 509 static_cast<VisitSource>(statement.ColumnInt(1))); |
| 507 sources->insert(source_entry); | 510 sources->insert(source_entry); |
| 508 } | 511 } |
| 509 } | 512 } |
| 510 } | 513 } |
| 511 | 514 |
| 512 } // namespace history | 515 } // namespace history |
| OLD | NEW |