OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_STATEMENT_H_ | 5 #ifndef SQL_STATEMENT_H_ |
6 #define SQL_STATEMENT_H_ | 6 #define SQL_STATEMENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 // Returns the number of output columns in the result. | 119 // Returns the number of output columns in the result. |
120 int ColumnCount() const; | 120 int ColumnCount() const; |
121 | 121 |
122 // Returns the type associated with the given column. | 122 // Returns the type associated with the given column. |
123 // | 123 // |
124 // Watch out: the type may be undefined if you've done something to cause a | 124 // Watch out: the type may be undefined if you've done something to cause a |
125 // "type conversion." This means requesting the value of a column of a type | 125 // "type conversion." This means requesting the value of a column of a type |
126 // where that type is not the native type. For safety, call ColumnType only | 126 // where that type is not the native type. For safety, call ColumnType only |
127 // on a column before getting the value out in any way. | 127 // on a column before getting the value out in any way. |
128 ColType ColumnType(int col) const; | 128 ColType ColumnType(int col) const; |
129 ColType DeclaredColumnType(int col) const; | |
129 | 130 |
130 // These all take a 0-based argument index. | 131 // These all take a 0-based argument index. |
131 bool ColumnBool(int col) const; | 132 bool ColumnBool(int col) const; |
132 int ColumnInt(int col) const; | 133 int ColumnInt(int col) const; |
133 int64 ColumnInt64(int col) const; | 134 int64 ColumnInt64(int col) const; |
134 double ColumnDouble(int col) const; | 135 double ColumnDouble(int col) const; |
135 std::string ColumnString(int col) const; | 136 std::string ColumnString(int col) const; |
136 string16 ColumnString16(int col) const; | 137 string16 ColumnString16(int col) const; |
137 | 138 |
138 // When reading a blob, you can get a raw pointer to the underlying data, | 139 // When reading a blob, you can get a raw pointer to the underlying data, |
139 // along with the length, or you can just ask us to copy the blob into a | 140 // along with the length, or you can just ask us to copy the blob into a |
140 // vector. Danger! ColumnBlob may return NULL if there is no data! | 141 // vector. Danger! ColumnBlob may return NULL if there is no data! |
141 int ColumnByteLength(int col) const; | 142 int ColumnByteLength(int col) const; |
142 const void* ColumnBlob(int col) const; | 143 const void* ColumnBlob(int col) const; |
143 bool ColumnBlobAsString(int col, std::string* blob); | 144 bool ColumnBlobAsString(int col, std::string* blob); |
144 bool ColumnBlobAsVector(int col, std::vector<char>* val) const; | 145 bool ColumnBlobAsVector(int col, std::vector<char>* val) const; |
145 bool ColumnBlobAsVector(int col, std::vector<unsigned char>* val) const; | 146 bool ColumnBlobAsVector(int col, std::vector<unsigned char>* val) const; |
147 bool ColumnBlobAsString16(int col, string16* val) const; | |
michaeln
2012/02/01 21:03:11
can u move this up so its under the other String v
benm (inactive)
2012/02/02 12:14:49
Done.
| |
146 | 148 |
147 // Diagnostics -------------------------------------------------------------- | 149 // Diagnostics -------------------------------------------------------------- |
148 | 150 |
149 // Returns the original text of sql statement. Do not keep a pointer to it. | 151 // Returns the original text of sql statement. Do not keep a pointer to it. |
150 const char* GetSQLStatement(); | 152 const char* GetSQLStatement(); |
151 | 153 |
152 private: | 154 private: |
153 // This is intended to check for serious errors and report them to the | 155 // This is intended to check for serious errors and report them to the |
154 // connection object. It takes a sqlite error code, and returns the same | 156 // connection object. It takes a sqlite error code, and returns the same |
155 // code. Currently this function just updates the succeeded flag, but will be | 157 // code. Currently this function just updates the succeeded flag, but will be |
(...skipping 25 matching lines...) Expand all Loading... | |
181 | 183 |
182 // See Succeeded() for what this holds. | 184 // See Succeeded() for what this holds. |
183 bool succeeded_; | 185 bool succeeded_; |
184 | 186 |
185 DISALLOW_COPY_AND_ASSIGN(Statement); | 187 DISALLOW_COPY_AND_ASSIGN(Statement); |
186 }; | 188 }; |
187 | 189 |
188 } // namespace sql | 190 } // namespace sql |
189 | 191 |
190 #endif // SQL_STATEMENT_H_ | 192 #endif // SQL_STATEMENT_H_ |
OLD | NEW |