| 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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "third_party/sqlite/sqlite3.h" | 10 #include "third_party/sqlite/sqlite3.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 static_assert(COLUMN_TYPE_INTEGER == SQLITE_INTEGER, "integer no match"); | 203 static_assert(COLUMN_TYPE_INTEGER == SQLITE_INTEGER, "integer no match"); |
| 204 static_assert(COLUMN_TYPE_FLOAT == SQLITE_FLOAT, "float no match"); | 204 static_assert(COLUMN_TYPE_FLOAT == SQLITE_FLOAT, "float no match"); |
| 205 static_assert(COLUMN_TYPE_TEXT == SQLITE_TEXT, "integer no match"); | 205 static_assert(COLUMN_TYPE_TEXT == SQLITE_TEXT, "integer no match"); |
| 206 static_assert(COLUMN_TYPE_BLOB == SQLITE_BLOB, "blob no match"); | 206 static_assert(COLUMN_TYPE_BLOB == SQLITE_BLOB, "blob no match"); |
| 207 static_assert(COLUMN_TYPE_NULL == SQLITE_NULL, "null no match"); | 207 static_assert(COLUMN_TYPE_NULL == SQLITE_NULL, "null no match"); |
| 208 | 208 |
| 209 return static_cast<ColType>(sqlite3_column_type(ref_->stmt(), col)); | 209 return static_cast<ColType>(sqlite3_column_type(ref_->stmt(), col)); |
| 210 } | 210 } |
| 211 | 211 |
| 212 ColType Statement::DeclaredColumnType(int col) const { | 212 ColType Statement::DeclaredColumnType(int col) const { |
| 213 std::string column_type(sqlite3_column_decltype(ref_->stmt(), col)); | 213 std::string column_type = base::ToLowerASCII( |
| 214 base::StringToLowerASCII(&column_type); | 214 sqlite3_column_decltype(ref_->stmt(), col)); |
| 215 | 215 |
| 216 if (column_type == "integer") | 216 if (column_type == "integer") |
| 217 return COLUMN_TYPE_INTEGER; | 217 return COLUMN_TYPE_INTEGER; |
| 218 else if (column_type == "float") | 218 else if (column_type == "float") |
| 219 return COLUMN_TYPE_FLOAT; | 219 return COLUMN_TYPE_FLOAT; |
| 220 else if (column_type == "text") | 220 else if (column_type == "text") |
| 221 return COLUMN_TYPE_TEXT; | 221 return COLUMN_TYPE_TEXT; |
| 222 else if (column_type == "blob") | 222 else if (column_type == "blob") |
| 223 return COLUMN_TYPE_BLOB; | 223 return COLUMN_TYPE_BLOB; |
| 224 | 224 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 int Statement::CheckError(int err) { | 350 int Statement::CheckError(int err) { |
| 351 // Please don't add DCHECKs here, OnSqliteError() already has them. | 351 // Please don't add DCHECKs here, OnSqliteError() already has them. |
| 352 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); | 352 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); |
| 353 if (!succeeded_ && ref_.get() && ref_->connection()) | 353 if (!succeeded_ && ref_.get() && ref_->connection()) |
| 354 return ref_->connection()->OnSqliteError(err, this, NULL); | 354 return ref_->connection()->OnSqliteError(err, this, NULL); |
| 355 return err; | 355 return err; |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace sql | 358 } // namespace sql |
| OLD | NEW |