| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 COMPILE_ASSERT(COLUMN_TYPE_FLOAT == SQLITE_FLOAT, float_no_match); | 175 COMPILE_ASSERT(COLUMN_TYPE_FLOAT == SQLITE_FLOAT, float_no_match); |
| 176 COMPILE_ASSERT(COLUMN_TYPE_TEXT == SQLITE_TEXT, integer_no_match); | 176 COMPILE_ASSERT(COLUMN_TYPE_TEXT == SQLITE_TEXT, integer_no_match); |
| 177 COMPILE_ASSERT(COLUMN_TYPE_BLOB == SQLITE_BLOB, blob_no_match); | 177 COMPILE_ASSERT(COLUMN_TYPE_BLOB == SQLITE_BLOB, blob_no_match); |
| 178 COMPILE_ASSERT(COLUMN_TYPE_NULL == SQLITE_NULL, null_no_match); | 178 COMPILE_ASSERT(COLUMN_TYPE_NULL == SQLITE_NULL, null_no_match); |
| 179 | 179 |
| 180 return static_cast<ColType>(sqlite3_column_type(ref_->stmt(), col)); | 180 return static_cast<ColType>(sqlite3_column_type(ref_->stmt(), col)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 ColType Statement::DeclaredColumnType(int col) const { | 183 ColType Statement::DeclaredColumnType(int col) const { |
| 184 std::string column_type(sqlite3_column_decltype(ref_->stmt(), col)); | 184 std::string column_type(sqlite3_column_decltype(ref_->stmt(), col)); |
| 185 StringToLowerASCII(&column_type); | 185 base::StringToLowerASCII(&column_type); |
| 186 | 186 |
| 187 if (column_type == "integer") | 187 if (column_type == "integer") |
| 188 return COLUMN_TYPE_INTEGER; | 188 return COLUMN_TYPE_INTEGER; |
| 189 else if (column_type == "float") | 189 else if (column_type == "float") |
| 190 return COLUMN_TYPE_FLOAT; | 190 return COLUMN_TYPE_FLOAT; |
| 191 else if (column_type == "text") | 191 else if (column_type == "text") |
| 192 return COLUMN_TYPE_TEXT; | 192 return COLUMN_TYPE_TEXT; |
| 193 else if (column_type == "blob") | 193 else if (column_type == "blob") |
| 194 return COLUMN_TYPE_BLOB; | 194 return COLUMN_TYPE_BLOB; |
| 195 | 195 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 int Statement::CheckError(int err) { | 321 int Statement::CheckError(int err) { |
| 322 // Please don't add DCHECKs here, OnSqliteError() already has them. | 322 // Please don't add DCHECKs here, OnSqliteError() already has them. |
| 323 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); | 323 succeeded_ = (err == SQLITE_OK || err == SQLITE_ROW || err == SQLITE_DONE); |
| 324 if (!succeeded_ && ref_.get() && ref_->connection()) | 324 if (!succeeded_ && ref_.get() && ref_->connection()) |
| 325 return ref_->connection()->OnSqliteError(err, this, NULL); | 325 return ref_->connection()->OnSqliteError(err, this, NULL); |
| 326 return err; | 326 return err; |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace sql | 329 } // namespace sql |
| OLD | NEW |