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

Side by Side Diff: sql/statement.cc

Issue 9384004: Fix Android build. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 10 months 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
« no previous file with comments | « no previous file | 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) 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 <algorithm>
8
9 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
11 #include "third_party/sqlite/sqlite3.h" 10 #include "third_party/sqlite/sqlite3.h"
12 11
13 namespace sql { 12 namespace sql {
14 13
15 // This empty constructor initializes our reference with an empty one so that 14 // This empty constructor initializes our reference with an empty one so that
16 // we don't have to NULL-check the ref_ to see if the statement is valid: we 15 // we don't have to NULL-check the ref_ to see if the statement is valid: we
17 // only have to check the ref's validity bit. 16 // only have to check the ref's validity bit.
18 Statement::Statement() 17 Statement::Statement()
19 : ref_(new Connection::StatementRef), 18 : ref_(new Connection::StatementRef),
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 COMPILE_ASSERT(COLUMN_TYPE_FLOAT == SQLITE_FLOAT, float_no_match); 151 COMPILE_ASSERT(COLUMN_TYPE_FLOAT == SQLITE_FLOAT, float_no_match);
153 COMPILE_ASSERT(COLUMN_TYPE_TEXT == SQLITE_TEXT, integer_no_match); 152 COMPILE_ASSERT(COLUMN_TYPE_TEXT == SQLITE_TEXT, integer_no_match);
154 COMPILE_ASSERT(COLUMN_TYPE_BLOB == SQLITE_BLOB, blob_no_match); 153 COMPILE_ASSERT(COLUMN_TYPE_BLOB == SQLITE_BLOB, blob_no_match);
155 COMPILE_ASSERT(COLUMN_TYPE_NULL == SQLITE_NULL, null_no_match); 154 COMPILE_ASSERT(COLUMN_TYPE_NULL == SQLITE_NULL, null_no_match);
156 155
157 return static_cast<ColType>(sqlite3_column_type(ref_->stmt(), col)); 156 return static_cast<ColType>(sqlite3_column_type(ref_->stmt(), col));
158 } 157 }
159 158
160 ColType Statement::DeclaredColumnType(int col) const { 159 ColType Statement::DeclaredColumnType(int col) const {
161 std::string column_type(sqlite3_column_decltype(ref_->stmt(), col)); 160 std::string column_type(sqlite3_column_decltype(ref_->stmt(), col));
162 std::transform(column_type.begin(), column_type.end(), column_type.begin(), 161 StringToLowerASCII(&column_type);
163 ::tolower);
164 162
165 if (column_type == "integer") 163 if (column_type == "integer")
166 return COLUMN_TYPE_INTEGER; 164 return COLUMN_TYPE_INTEGER;
167 else if (column_type == "float") 165 else if (column_type == "float")
168 return COLUMN_TYPE_FLOAT; 166 return COLUMN_TYPE_FLOAT;
169 else if (column_type == "text") 167 else if (column_type == "text")
170 return COLUMN_TYPE_TEXT; 168 return COLUMN_TYPE_TEXT;
171 else if (column_type == "blob") 169 else if (column_type == "blob")
172 return COLUMN_TYPE_BLOB; 170 return COLUMN_TYPE_BLOB;
173 171
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 296
299 int Statement::CheckError(int err) { 297 int Statement::CheckError(int err) {
300 // Please don't add DCHECKs here, OnSqliteError() already has them. 298 // Please don't add DCHECKs here, OnSqliteError() already has them.
301 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); 299 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE);
302 if (!succeeded_ && is_valid()) 300 if (!succeeded_ && is_valid())
303 return ref_->connection()->OnSqliteError(err, this); 301 return ref_->connection()->OnSqliteError(err, this);
304 return err; 302 return err;
305 } 303 }
306 304
307 } // namespace sql 305 } // namespace sql
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698