| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/url_database.h" | 5 #include "chrome/browser/history/url_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 return false; | 256 return false; |
| 257 } | 257 } |
| 258 enumerator->initialized_ = true; | 258 enumerator->initialized_ = true; |
| 259 return true; | 259 return true; |
| 260 } | 260 } |
| 261 | 261 |
| 262 bool URLDatabase::InitURLEnumeratorForSignificant(URLEnumerator* enumerator) { | 262 bool URLDatabase::InitURLEnumeratorForSignificant(URLEnumerator* enumerator) { |
| 263 DCHECK(!enumerator->initialized_); | 263 DCHECK(!enumerator->initialized_); |
| 264 std::string sql("SELECT "); | 264 std::string sql("SELECT "); |
| 265 sql.append(kURLRowFields); | 265 sql.append(kURLRowFields); |
| 266 sql.append(" FROM urls WHERE last_visit_time >= ? OR visit_count > ? OR " | 266 sql.append(" FROM urls WHERE last_visit_time >= ? OR visit_count >= ? OR " |
| 267 "typed_count > ?"); | 267 "typed_count >= ?"); |
| 268 enumerator->statement_.Assign(GetDB().GetUniqueStatement(sql.c_str())); | 268 enumerator->statement_.Assign(GetDB().GetUniqueStatement(sql.c_str())); |
| 269 if (!enumerator->statement_) { | 269 if (!enumerator->statement_) { |
| 270 NOTREACHED() << GetDB().GetErrorMessage(); | 270 NOTREACHED() << GetDB().GetErrorMessage(); |
| 271 return false; | 271 return false; |
| 272 } | 272 } |
| 273 enumerator->statement_.BindInt64( | 273 enumerator->statement_.BindInt64( |
| 274 0, AutocompleteAgeThreshold().ToInternalValue()); | 274 0, AutocompleteAgeThreshold().ToInternalValue()); |
| 275 enumerator->statement_.BindInt(1, kLowQualityMatchVisitLimit); | 275 enumerator->statement_.BindInt(1, kLowQualityMatchVisitLimit); |
| 276 enumerator->statement_.BindInt(2, kLowQualityMatchTypedLimit); | 276 enumerator->statement_.BindInt(2, kLowQualityMatchTypedLimit); |
| 277 enumerator->initialized_ = true; | 277 enumerator->initialized_ = true; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 return GetDB().Execute(sql.c_str()); | 552 return GetDB().Execute(sql.c_str()); |
| 553 } | 553 } |
| 554 | 554 |
| 555 void URLDatabase::CreateMainURLIndex() { | 555 void URLDatabase::CreateMainURLIndex() { |
| 556 // Index over URLs so we can quickly look up based on URL. Ignore errors as | 556 // Index over URLs so we can quickly look up based on URL. Ignore errors as |
| 557 // this likely already exists (and the same below). | 557 // this likely already exists (and the same below). |
| 558 GetDB().Execute("CREATE INDEX urls_url_index ON urls (url)"); | 558 GetDB().Execute("CREATE INDEX urls_url_index ON urls (url)"); |
| 559 } | 559 } |
| 560 | 560 |
| 561 } // namespace history | 561 } // namespace history |
| OLD | NEW |