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 #ifndef SQL_META_TABLE_H_ | 5 #ifndef SQL_META_TABLE_H_ |
6 #define SQL_META_TABLE_H_ | 6 #define SQL_META_TABLE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/macros.h" |
11 #include "sql/sql_export.h" | 12 #include "sql/sql_export.h" |
12 | 13 |
13 namespace sql { | 14 namespace sql { |
14 | 15 |
15 class Connection; | 16 class Connection; |
16 class Statement; | 17 class Statement; |
17 | 18 |
18 class SQL_EXPORT MetaTable { | 19 class SQL_EXPORT MetaTable { |
19 public: | 20 public: |
20 MetaTable(); | 21 MetaTable(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // it's larger than you code is expecting, fail. | 68 // it's larger than you code is expecting, fail. |
68 // | 69 // |
69 // The compatible version number will be 0 if there is no previously set | 70 // The compatible version number will be 0 if there is no previously set |
70 // compatible version number. | 71 // compatible version number. |
71 void SetCompatibleVersionNumber(int version); | 72 void SetCompatibleVersionNumber(int version); |
72 int GetCompatibleVersionNumber(); | 73 int GetCompatibleVersionNumber(); |
73 | 74 |
74 // Set the given arbitrary key with the given data. Returns true on success. | 75 // Set the given arbitrary key with the given data. Returns true on success. |
75 bool SetValue(const char* key, const std::string& value); | 76 bool SetValue(const char* key, const std::string& value); |
76 bool SetValue(const char* key, int value); | 77 bool SetValue(const char* key, int value); |
77 bool SetValue(const char* key, int64 value); | 78 bool SetValue(const char* key, int64_t value); |
78 | 79 |
79 // Retrieves the value associated with the given key. This will use sqlite's | 80 // Retrieves the value associated with the given key. This will use sqlite's |
80 // type conversion rules. It will return true on success. | 81 // type conversion rules. It will return true on success. |
81 bool GetValue(const char* key, std::string* value); | 82 bool GetValue(const char* key, std::string* value); |
82 bool GetValue(const char* key, int* value); | 83 bool GetValue(const char* key, int* value); |
83 bool GetValue(const char* key, int64* value); | 84 bool GetValue(const char* key, int64_t* value); |
84 | 85 |
85 // Deletes the key from the table. | 86 // Deletes the key from the table. |
86 bool DeleteKey(const char* key); | 87 bool DeleteKey(const char* key); |
87 | 88 |
88 private: | 89 private: |
89 // Conveniences to prepare the two types of statements used by | 90 // Conveniences to prepare the two types of statements used by |
90 // MetaTableHelper. | 91 // MetaTableHelper. |
91 void PrepareSetStatement(Statement* statement, const char* key); | 92 void PrepareSetStatement(Statement* statement, const char* key); |
92 bool PrepareGetStatement(Statement* statement, const char* key); | 93 bool PrepareGetStatement(Statement* statement, const char* key); |
93 | 94 |
94 Connection* db_; | 95 Connection* db_; |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(MetaTable); | 97 DISALLOW_COPY_AND_ASSIGN(MetaTable); |
97 }; | 98 }; |
98 | 99 |
99 } // namespace sql | 100 } // namespace sql |
100 | 101 |
101 #endif // SQL_META_TABLE_H_ | 102 #endif // SQL_META_TABLE_H_ |
OLD | NEW |