OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef SQL_RECOVERY_H_ | 5 #ifndef SQL_RECOVERY_H_ |
6 #define SQL_RECOVERY_H_ | 6 #define SQL_RECOVERY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 | 9 |
10 #include "sql/connection.h" | 10 #include "sql/connection.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // } | 34 // } |
35 // } | 35 // } |
36 // | 36 // |
37 // If Recovered() is not called, then RazeAndClose() is called on | 37 // If Recovered() is not called, then RazeAndClose() is called on |
38 // orig_db. | 38 // orig_db. |
39 | 39 |
40 class SQL_EXPORT Recovery { | 40 class SQL_EXPORT Recovery { |
41 public: | 41 public: |
42 ~Recovery(); | 42 ~Recovery(); |
43 | 43 |
| 44 // This module is intended to be used in concert with a virtual |
| 45 // table module (see third_party/sqlite/src/src/recover.c). If the |
| 46 // build defines USE_SYSTEM_SQLITE, this module will not be present. |
| 47 // TODO(shess): I am still debating how to handle this - perhaps it |
| 48 // will just imply Unrecoverable(). This is exposed to allow tests |
| 49 // to adapt to the cases, please do not rely on it in production |
| 50 // code. |
| 51 static bool FullRecoverySupported(); |
| 52 |
44 // Begin the recovery process by opening a temporary database handle | 53 // Begin the recovery process by opening a temporary database handle |
45 // and attach the existing database to it at "corrupt". To prevent | 54 // and attach the existing database to it at "corrupt". To prevent |
46 // deadlock, all transactions on |connection| are rolled back. | 55 // deadlock, all transactions on |connection| are rolled back. |
47 // | 56 // |
48 // Returns NULL in case of failure, with no cleanup done on the | 57 // Returns NULL in case of failure, with no cleanup done on the |
49 // original connection (except for breaking the transactions). The | 58 // original connection (except for breaking the transactions). The |
50 // caller should Raze() or otherwise cleanup as appropriate. | 59 // caller should Raze() or otherwise cleanup as appropriate. |
51 // | 60 // |
52 // TODO(shess): Later versions of SQLite allow extracting the path | 61 // TODO(shess): Later versions of SQLite allow extracting the path |
53 // from the connection. | 62 // from the connection. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 114 |
106 Connection* db_; // Original database connection. | 115 Connection* db_; // Original database connection. |
107 Connection recover_db_; // Recovery connection. | 116 Connection recover_db_; // Recovery connection. |
108 | 117 |
109 DISALLOW_COPY_AND_ASSIGN(Recovery); | 118 DISALLOW_COPY_AND_ASSIGN(Recovery); |
110 }; | 119 }; |
111 | 120 |
112 } // namespace sql | 121 } // namespace sql |
113 | 122 |
114 #endif // SQL_RECOVERY_H_ | 123 #endif // SQL_RECOVERY_H_ |
OLD | NEW |