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 #include "sql/statement.h" | 5 #include "sql/statement.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "third_party/sqlite/sqlite3.h" | 9 #include "third_party/sqlite/sqlite3.h" |
10 | 10 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 int col, | 249 int col, |
250 std::vector<unsigned char>* val) const { | 250 std::vector<unsigned char>* val) const { |
251 return ColumnBlobAsVector(col, reinterpret_cast< std::vector<char>* >(val)); | 251 return ColumnBlobAsVector(col, reinterpret_cast< std::vector<char>* >(val)); |
252 } | 252 } |
253 | 253 |
254 const char* Statement::GetSQLStatement() { | 254 const char* Statement::GetSQLStatement() { |
255 return sqlite3_sql(ref_->stmt()); | 255 return sqlite3_sql(ref_->stmt()); |
256 } | 256 } |
257 | 257 |
258 bool Statement::CheckOk(int err) const { | 258 bool Statement::CheckOk(int err) const { |
259 // TODO(shess,gbillock): This is only called by Bind*(). | |
260 // Should there be a DLOG(FATAL) on it? | |
Scott Hess - ex-Googler
2011/12/15 23:02:57
I maybe don't understand the comment. I'd be fine
Greg Billock
2011/12/16 17:26:58
Yeah. This is basically a placeholder to move the
Scott Hess - ex-Googler
2011/12/16 22:37:08
Agreed.
| |
261 if (err == SQLITE_RANGE) | |
262 DLOG(FATAL) << "Bind value out of range"; | |
259 return err == SQLITE_OK; | 263 return err == SQLITE_OK; |
260 } | 264 } |
261 | 265 |
262 int Statement::CheckError(int err) { | 266 int Statement::CheckError(int err) { |
263 // Please don't add DCHECKs here, OnSqliteError() already has them. | 267 // Please don't add DCHECKs here, OnSqliteError() already has them. |
264 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); | 268 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); |
265 if (!succeeded_ && is_valid()) | 269 if (!succeeded_ && is_valid()) |
266 return ref_->connection()->OnSqliteError(err, this); | 270 return ref_->connection()->OnSqliteError(err, this); |
267 return err; | 271 return err; |
268 } | 272 } |
269 | 273 |
270 } // namespace sql | 274 } // namespace sql |
OLD | NEW |