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 #include "sql/statement.h" | 5 #include "sql/statement.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "third_party/sqlite/sqlite3.h" | 10 #include "third_party/sqlite/sqlite3.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // We don't call CheckError() here because sqlite3_reset() returns | 66 // We don't call CheckError() here because sqlite3_reset() returns |
67 // the last error that Step() caused thereby generating a second | 67 // the last error that Step() caused thereby generating a second |
68 // spurious error callback. | 68 // spurious error callback. |
69 sqlite3_clear_bindings(ref_->stmt()); | 69 sqlite3_clear_bindings(ref_->stmt()); |
70 sqlite3_reset(ref_->stmt()); | 70 sqlite3_reset(ref_->stmt()); |
71 } | 71 } |
72 | 72 |
73 succeeded_ = false; | 73 succeeded_ = false; |
74 } | 74 } |
75 | 75 |
| 76 void Statement::ResetWithoutClearingBoundVariables() { |
| 77 if (is_valid()) { |
| 78 sqlite3_reset(ref_->stmt()); |
| 79 } |
| 80 } |
| 81 |
76 bool Statement::Succeeded() const { | 82 bool Statement::Succeeded() const { |
77 if (!is_valid()) | 83 if (!is_valid()) |
78 return false; | 84 return false; |
79 | 85 |
80 return succeeded_; | 86 return succeeded_; |
81 } | 87 } |
82 | 88 |
83 bool Statement::BindNull(int col) { | 89 bool Statement::BindNull(int col) { |
84 if (!is_valid()) | 90 if (!is_valid()) |
85 return false; | 91 return false; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 307 |
302 int Statement::CheckError(int err) { | 308 int Statement::CheckError(int err) { |
303 // Please don't add DCHECKs here, OnSqliteError() already has them. | 309 // Please don't add DCHECKs here, OnSqliteError() already has them. |
304 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); | 310 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); |
305 if (!succeeded_ && is_valid()) | 311 if (!succeeded_ && is_valid()) |
306 return ref_->connection()->OnSqliteError(err, this); | 312 return ref_->connection()->OnSqliteError(err, this); |
307 return err; | 313 return err; |
308 } | 314 } |
309 | 315 |
310 } // namespace sql | 316 } // namespace sql |
OLD | NEW |