| OLD | NEW |
| 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/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 | 9 |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "chrome/common/l10n_util.h" | 11 #include "chrome/common/l10n_util.h" |
| 12 #include "chrome/common/sqlite_utils.h" | 12 #include "chrome/common/sqlite_utils.h" |
| 13 #include "chrome/common/url_constants.h" | |
| 14 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 15 | 14 |
| 16 using base::Time; | 15 using base::Time; |
| 17 | 16 |
| 18 namespace history { | 17 namespace history { |
| 19 | 18 |
| 20 const char URLDatabase::kURLRowFields[] = HISTORY_URL_ROW_FIELDS; | 19 const char URLDatabase::kURLRowFields[] = HISTORY_URL_ROW_FIELDS; |
| 21 const int URLDatabase::kNumURLRowFields = 9; | 20 const int URLDatabase::kNumURLRowFields = 9; |
| 22 | 21 |
| 23 bool URLDatabase::URLEnumerator::GetNextURL(URLRow* r) { | 22 bool URLDatabase::URLEnumerator::GetNextURL(URLRow* r) { |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 KeywordSearchTermVisit visit; | 401 KeywordSearchTermVisit visit; |
| 403 while (statement->step() == SQLITE_ROW) { | 402 while (statement->step() == SQLITE_ROW) { |
| 404 visit.term = statement->column_wstring(0); | 403 visit.term = statement->column_wstring(0); |
| 405 visit.time = Time::FromInternalValue(statement->column_int64(1)); | 404 visit.time = Time::FromInternalValue(statement->column_int64(1)); |
| 406 matches->push_back(visit); | 405 matches->push_back(visit); |
| 407 } | 406 } |
| 408 } | 407 } |
| 409 | 408 |
| 410 bool URLDatabase::MigrateFromVersion11ToVersion12() { | 409 bool URLDatabase::MigrateFromVersion11ToVersion12() { |
| 411 URLRow about_row; | 410 URLRow about_row; |
| 412 if (GetRowForURL(GURL(chrome::kAboutBlankURL), &about_row)) { | 411 if (GetRowForURL(GURL("about:blank"), &about_row)) { |
| 413 about_row.set_favicon_id(0); | 412 about_row.set_favicon_id(0); |
| 414 return UpdateURLRow(about_row.id(), about_row); | 413 return UpdateURLRow(about_row.id(), about_row); |
| 415 } | 414 } |
| 416 return true; | 415 return true; |
| 417 } | 416 } |
| 418 | 417 |
| 419 bool URLDatabase::DropStarredIDFromURLs() { | 418 bool URLDatabase::DropStarredIDFromURLs() { |
| 420 if (!DoesSqliteColumnExist(GetDB(), "urls", "starred_id", NULL)) | 419 if (!DoesSqliteColumnExist(GetDB(), "urls", "starred_id", NULL)) |
| 421 return true; // urls is already updated, no need to continue. | 420 return true; // urls is already updated, no need to continue. |
| 422 | 421 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 } | 474 } |
| 476 | 475 |
| 477 void URLDatabase::CreateSupplimentaryURLIndices() { | 476 void URLDatabase::CreateSupplimentaryURLIndices() { |
| 478 // Add a favicon index. This is useful when we delete urls. | 477 // Add a favicon index. This is useful when we delete urls. |
| 479 sqlite3_exec(GetDB(), "CREATE INDEX urls_favicon_id_INDEX ON urls (favicon_id)
", | 478 sqlite3_exec(GetDB(), "CREATE INDEX urls_favicon_id_INDEX ON urls (favicon_id)
", |
| 480 NULL, NULL, NULL); | 479 NULL, NULL, NULL); |
| 481 } | 480 } |
| 482 | 481 |
| 483 } // namespace history | 482 } // namespace history |
| 484 | 483 |
| OLD | NEW |