OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 APP_SQL_META_TABLE_H_ | 5 #ifndef APP_SQL_META_TABLE_H_ |
6 #define APP_SQL_META_TABLE_H_ | 6 #define APP_SQL_META_TABLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 namespace sql { | 12 namespace sql { |
13 | 13 |
14 class Connection; | 14 class Connection; |
15 class Statement; | 15 class Statement; |
16 | 16 |
17 class MetaTable { | 17 class MetaTable { |
18 public: | 18 public: |
19 // Returns true if the 'meta' table exists. | 19 // Returns true if the 'meta' table exists. |
20 static bool DoesTableExist(Connection* db); | 20 static bool DoesTableExist(Connection* db); |
21 | 21 |
22 MetaTable(); | 22 MetaTable(); |
23 ~MetaTable(); | 23 ~MetaTable(); |
24 | 24 |
25 // Initializes the MetaTableHelper, creating the meta table if necessary. For | 25 // Initializes the MetaTableHelper, creating the meta table if necessary. For |
26 // new tables, it will initialize the version number to |version| and the | 26 // new tables, it will initialize the version number to |version| and the |
27 // compatible version number to |compatible_version|. | 27 // compatible version number to |compatible_version|. |
28 bool Init(Connection* db, int version, int compatible_version); | 28 bool Init(Connection* db, int version, int compatible_version); |
29 | 29 |
| 30 // Resets this MetaTable object, making another call to Init() possible. |
| 31 void Reset(); |
| 32 |
30 // The version number of the database. This should be the version number of | 33 // The version number of the database. This should be the version number of |
31 // the creator of the file. The version number will be 0 if there is no | 34 // the creator of the file. The version number will be 0 if there is no |
32 // previously set version number. | 35 // previously set version number. |
33 // | 36 // |
34 // See also Get/SetCompatibleVersionNumber(). | 37 // See also Get/SetCompatibleVersionNumber(). |
35 void SetVersionNumber(int version); | 38 void SetVersionNumber(int version); |
36 int GetVersionNumber(); | 39 int GetVersionNumber(); |
37 | 40 |
38 // The compatible version number is the lowest version of the code that this | 41 // The compatible version number is the lowest version of the code that this |
39 // database can be read by. If there are minor changes or additions, old | 42 // database can be read by. If there are minor changes or additions, old |
(...skipping 30 matching lines...) Expand all Loading... |
70 bool PrepareGetStatement(Statement* statement, const char* key); | 73 bool PrepareGetStatement(Statement* statement, const char* key); |
71 | 74 |
72 Connection* db_; | 75 Connection* db_; |
73 | 76 |
74 DISALLOW_COPY_AND_ASSIGN(MetaTable); | 77 DISALLOW_COPY_AND_ASSIGN(MetaTable); |
75 }; | 78 }; |
76 | 79 |
77 } // namespace sql | 80 } // namespace sql |
78 | 81 |
79 #endif // APP_SQL_META_TABLE_H_ | 82 #endif // APP_SQL_META_TABLE_H_ |
OLD | NEW |