Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: sql/statement.cc

Issue 8966003: Update webdata files to take advantage of DLOG(FATAL) in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add header comments for a couple tricky error cases. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sql/statement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Binding to a non-existent variable is evidence of a serious error.
260 // TODO(gbillock,shess): make this invalidate the statement so it
261 // can't wreak havoc.
262 if (err == SQLITE_RANGE)
263 DLOG(FATAL) << "Bind value out of range";
259 return err == SQLITE_OK; 264 return err == SQLITE_OK;
260 } 265 }
261 266
262 int Statement::CheckError(int err) { 267 int Statement::CheckError(int err) {
263 // Please don't add DCHECKs here, OnSqliteError() already has them. 268 // Please don't add DCHECKs here, OnSqliteError() already has them.
264 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); 269 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE);
265 if (!succeeded_ && is_valid()) 270 if (!succeeded_ && is_valid())
266 return ref_->connection()->OnSqliteError(err, this); 271 return ref_->connection()->OnSqliteError(err, this);
267 return err; 272 return err;
268 } 273 }
269 274
270 } // namespace sql 275 } // namespace sql
OLDNEW
« no previous file with comments | « sql/statement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698