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_STATEMENT_H_ | 5 #ifndef APP_SQL_STATEMENT_H_ |
6 #define APP_SQL_STATEMENT_H_ | 6 #define APP_SQL_STATEMENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 // These all take a 0-based argument index. | 99 // These all take a 0-based argument index. |
100 int ColumnInt(int col) const; | 100 int ColumnInt(int col) const; |
101 int64 ColumnInt64(int col) const; | 101 int64 ColumnInt64(int col) const; |
102 double ColumnDouble(int col) const; | 102 double ColumnDouble(int col) const; |
103 std::string ColumnString(int col) const; | 103 std::string ColumnString(int col) const; |
104 | 104 |
105 // When reading a blob, you can get a raw pointer to the underlying data, | 105 // When reading a blob, you can get a raw pointer to the underlying data, |
106 // along with the length, or you can just ask us to copy the blob into a | 106 // along with the length, or you can just ask us to copy the blob into a |
107 // vector. Danger! ColumnBlob may return NULL if there is no data! | 107 // vector. Danger! ColumnBlob may return NULL if there is no data! |
108 int ColumnByteLength(int col); | 108 int ColumnByteLength(int col) const; |
109 const void* ColumnBlob(int col); | 109 const void* ColumnBlob(int col) const; |
110 void ColumnBlobAsVector(int col, std::vector<char>* val); | 110 void ColumnBlobAsVector(int col, std::vector<char>* val) const; |
| 111 void ColumnBlobAsVector(int col, std::vector<unsigned char>* val) const; |
111 | 112 |
112 private: | 113 private: |
113 // This is intended to check for serious errors and report them to the | 114 // This is intended to check for serious errors and report them to the |
114 // connection object. It takes a sqlite error code, and returns the same | 115 // connection object. It takes a sqlite error code, and returns the same |
115 // code. Currently this function just updates the succeeded flag, but will be | 116 // code. Currently this function just updates the succeeded flag, but will be |
116 // enhanced in the future to do the notification. | 117 // enhanced in the future to do the notification. |
117 int CheckError(int err); | 118 int CheckError(int err); |
118 | 119 |
119 // The actual sqlite statement. This may be unique to us, or it may be cached | 120 // The actual sqlite statement. This may be unique to us, or it may be cached |
120 // by the connection, which is why it's refcounted. This pointer is | 121 // by the connection, which is why it's refcounted. This pointer is |
121 // guaranteed non-NULL. | 122 // guaranteed non-NULL. |
122 scoped_refptr<Connection::StatementRef> ref_; | 123 scoped_refptr<Connection::StatementRef> ref_; |
123 | 124 |
124 // See Succeeded() for what this holds. | 125 // See Succeeded() for what this holds. |
125 bool succeeded_; | 126 bool succeeded_; |
126 | 127 |
127 DISALLOW_COPY_AND_ASSIGN(Statement); | 128 DISALLOW_COPY_AND_ASSIGN(Statement); |
128 }; | 129 }; |
129 | 130 |
130 } // namespace sql | 131 } // namespace sql |
131 | 132 |
132 #endif // APP_SQL_STATEMENT_H_ | 133 #endif // APP_SQL_STATEMENT_H_ |
OLD | NEW |