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