| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 explicit Statement(scoped_refptr<Connection::StatementRef> ref); | 51 explicit Statement(scoped_refptr<Connection::StatementRef> ref); |
| 52 ~Statement(); | 52 ~Statement(); |
| 53 | 53 |
| 54 // Initializes this object with the given statement, which may or may not | 54 // Initializes this object with the given statement, which may or may not |
| 55 // be valid. Use is_valid() to check if it's OK. | 55 // be valid. Use is_valid() to check if it's OK. |
| 56 void Assign(scoped_refptr<Connection::StatementRef> ref); | 56 void Assign(scoped_refptr<Connection::StatementRef> ref); |
| 57 | 57 |
| 58 // Returns true if the statement can be executed. All functions can still | 58 // Returns true if the statement can be executed. All functions can still |
| 59 // be used if the statement is invalid, but they will return failure or some | 59 // be used if the statement is invalid, but they will return failure or some |
| 60 // default value. This is because the statement can become invalid in the | 60 // default value. This is because the statement can become invalid in the |
| 61 // middle of executing a command if there is a serioud error and the database | 61 // middle of executing a command if there is a serious error and the database |
| 62 // has to be reset. | 62 // has to be reset. |
| 63 bool is_valid() const { return ref_->is_valid(); } | 63 bool is_valid() const { return ref_->is_valid(); } |
| 64 | 64 |
| 65 // These operators allow conveniently checking if the statement is valid | 65 // These operators allow conveniently checking if the statement is valid |
| 66 // or not. See the pattern above for an example. | 66 // or not. See the pattern above for an example. |
| 67 // TODO(shess,gbillock): Remove these once clients are converted. | 67 // TODO(shess,gbillock): Remove these once clients are converted. |
| 68 operator bool() const { return is_valid(); } | 68 operator bool() const { return is_valid(); } |
| 69 bool operator!() const { return !is_valid(); } | 69 bool operator!() const { return !is_valid(); } |
| 70 | 70 |
| 71 // Running ------------------------------------------------------------------- | 71 // Running ------------------------------------------------------------------- |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 // See Succeeded() for what this holds. | 182 // See Succeeded() for what this holds. |
| 183 bool succeeded_; | 183 bool succeeded_; |
| 184 | 184 |
| 185 DISALLOW_COPY_AND_ASSIGN(Statement); | 185 DISALLOW_COPY_AND_ASSIGN(Statement); |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 } // namespace sql | 188 } // namespace sql |
| 189 | 189 |
| 190 #endif // SQL_STATEMENT_H_ | 190 #endif // SQL_STATEMENT_H_ |
| OLD | NEW |