| 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_STATEMENT_H_ | 5 #ifndef SQL_STATEMENT_H_ |
| 6 #define SQL_STATEMENT_H_ | 6 #define SQL_STATEMENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "sql/connection.h" | 14 #include "sql/connection.h" |
| 15 #include "sql/sql_export.h" | 15 #include "sql/sql_export.h" |
| 16 | 16 |
| 17 namespace sql { | 17 namespace sql { |
| 18 | 18 |
| 19 // Possible return values from ColumnType in a statement. These should match | |
| 20 // the values in sqlite3.h. | |
| 21 enum ColType { | |
| 22 COLUMN_TYPE_INTEGER = 1, | |
| 23 COLUMN_TYPE_FLOAT = 2, | |
| 24 COLUMN_TYPE_TEXT = 3, | |
| 25 COLUMN_TYPE_BLOB = 4, | |
| 26 COLUMN_TYPE_NULL = 5, | |
| 27 }; | |
| 28 | |
| 29 // Normal usage: | 19 // Normal usage: |
| 30 // sql::Statement s(connection_.GetUniqueStatement(...)); | 20 // sql::Statement s(connection_.GetUniqueStatement(...)); |
| 31 // s.BindInt(0, a); | 21 // s.BindInt(0, a); |
| 32 // if (s.Step()) | 22 // if (s.Step()) |
| 33 // return s.ColumnString(0); | 23 // return s.ColumnString(0); |
| 34 // | 24 // |
| 35 // If there are errors getting the statement, the statement will be inert; no | 25 // If there are errors getting the statement, the statement will be inert; no |
| 36 // mutating or database-access methods will work. If you need to check for | 26 // mutating or database-access methods will work. If you need to check for |
| 37 // validity, use: | 27 // validity, use: |
| 38 // if (!s.is_valid()) | 28 // if (!s.is_valid()) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 170 |
| 181 // See Succeeded() for what this holds. | 171 // See Succeeded() for what this holds. |
| 182 bool succeeded_; | 172 bool succeeded_; |
| 183 | 173 |
| 184 DISALLOW_COPY_AND_ASSIGN(Statement); | 174 DISALLOW_COPY_AND_ASSIGN(Statement); |
| 185 }; | 175 }; |
| 186 | 176 |
| 187 } // namespace sql | 177 } // namespace sql |
| 188 | 178 |
| 189 #endif // SQL_STATEMENT_H_ | 179 #endif // SQL_STATEMENT_H_ |
| OLD | NEW |