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 "components/omnibox/browser/shortcuts_database.h" | 5 #include "components/omnibox/browser/shortcuts_database.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 base::StringPrintf("DELETE FROM omni_box_shortcuts WHERE %s = ?", | 54 base::StringPrintf("DELETE FROM omni_box_shortcuts WHERE %s = ?", |
55 field_name).c_str())); | 55 field_name).c_str())); |
56 s.BindString(0, id); | 56 s.BindString(0, id); |
57 return s.Run(); | 57 return s.Run(); |
58 } | 58 } |
59 | 59 |
60 void DatabaseErrorCallback(sql::Connection* db, | 60 void DatabaseErrorCallback(sql::Connection* db, |
61 const base::FilePath& db_path, | 61 const base::FilePath& db_path, |
62 int extended_error, | 62 int extended_error, |
63 sql::Statement* stmt) { | 63 sql::Statement* stmt) { |
64 if (sql::Recovery::ShouldRecover(extended_error)) { | 64 if (0 && sql::Recovery::ShouldRecover(extended_error)) { |
65 // Prevent reentrant calls. | 65 // Prevent reentrant calls. |
66 db->reset_error_callback(); | 66 db->reset_error_callback(); |
67 | 67 |
68 // After this call, the |db| handle is poisoned so that future calls will | 68 // After this call, the |db| handle is poisoned so that future calls will |
69 // return errors until the handle is re-opened. | 69 // return errors until the handle is re-opened. |
70 sql::Recovery::RecoverDatabase(db, db_path); | 70 sql::Recovery::RecoverDatabase(db, db_path); |
71 | 71 |
72 // The DLOG(FATAL) below is intended to draw immediate attention to errors | 72 // The DLOG(FATAL) below is intended to draw immediate attention to errors |
73 // in newly-written code. Database corruption is generally a result of OS | 73 // in newly-written code. Database corruption is generally a result of OS |
74 // or hardware issues, not coding errors at the client level, so displaying | 74 // or hardware issues, not coding errors at the client level, so displaying |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 "UPDATE omni_box_shortcuts SET type = 15 WHERE type = 11") && | 304 "UPDATE omni_box_shortcuts SET type = 15 WHERE type = 11") && |
305 // Migrate old BOOKMARK_TITLE values to the new type value. | 305 // Migrate old BOOKMARK_TITLE values to the new type value. |
306 db_.Execute( | 306 db_.Execute( |
307 "UPDATE omni_box_shortcuts SET type = 16 WHERE type = 12") && | 307 "UPDATE omni_box_shortcuts SET type = 16 WHERE type = 12") && |
308 transaction.Commit())) { | 308 transaction.Commit())) { |
309 return false; | 309 return false; |
310 } | 310 } |
311 } | 311 } |
312 return true; | 312 return true; |
313 } | 313 } |
OLD | NEW |