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