| 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/history_database.h" | 5 #include "chrome/browser/history/history_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // not be a released product that makes a database too old for us to handle. | 423 // not be a released product that makes a database too old for us to handle. |
| 424 LOG_IF(WARNING, cur_version < GetCurrentVersion()) << | 424 LOG_IF(WARNING, cur_version < GetCurrentVersion()) << |
| 425 "History database version " << cur_version << " is too old to handle."; | 425 "History database version " << cur_version << " is too old to handle."; |
| 426 | 426 |
| 427 return sql::INIT_OK; | 427 return sql::INIT_OK; |
| 428 } | 428 } |
| 429 | 429 |
| 430 #if !defined(OS_WIN) | 430 #if !defined(OS_WIN) |
| 431 void HistoryDatabase::MigrateTimeEpoch() { | 431 void HistoryDatabase::MigrateTimeEpoch() { |
| 432 // Update all the times in the URLs and visits table in the main database. | 432 // Update all the times in the URLs and visits table in the main database. |
| 433 // For visits, clear the indexed flag since we'll delete the FTS databases in | |
| 434 // the next step. | |
| 435 ignore_result(db_.Execute( | 433 ignore_result(db_.Execute( |
| 436 "UPDATE urls " | 434 "UPDATE urls " |
| 437 "SET last_visit_time = last_visit_time + 11644473600000000 " | 435 "SET last_visit_time = last_visit_time + 11644473600000000 " |
| 438 "WHERE id IN (SELECT id FROM urls WHERE last_visit_time > 0);")); | 436 "WHERE id IN (SELECT id FROM urls WHERE last_visit_time > 0);")); |
| 439 ignore_result(db_.Execute( | 437 ignore_result(db_.Execute( |
| 440 "UPDATE visits " | 438 "UPDATE visits " |
| 441 "SET visit_time = visit_time + 11644473600000000, is_indexed = 0 " | 439 "SET visit_time = visit_time + 11644473600000000 " |
| 442 "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);")); | 440 "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);")); |
| 443 ignore_result(db_.Execute( | 441 ignore_result(db_.Execute( |
| 444 "UPDATE segment_usage " | 442 "UPDATE segment_usage " |
| 445 "SET time_slot = time_slot + 11644473600000000 " | 443 "SET time_slot = time_slot + 11644473600000000 " |
| 446 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); | 444 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); |
| 447 | 445 |
| 448 // Erase all the full text index files. These will take a while to update and | 446 // Erase all the full text index files. These will take a while to update and |
| 449 // are less important, so we just blow them away. Same with the archived | 447 // are less important, so we just blow them away. Same with the archived |
| 450 // database. | 448 // database. |
| 451 needs_version_17_migration_ = true; | 449 needs_version_17_migration_ = true; |
| 452 } | 450 } |
| 453 #endif | 451 #endif |
| 454 | 452 |
| 455 } // namespace history | 453 } // namespace history |
| OLD | NEW |