| 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/connection.h" | 5 #include "sql/connection.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // static | 236 // static |
| 237 bool Connection::IsExpectedSqliteError(int error) { | 237 bool Connection::IsExpectedSqliteError(int error) { |
| 238 if (!current_expecter_cb_) | 238 if (!current_expecter_cb_) |
| 239 return false; | 239 return false; |
| 240 return current_expecter_cb_->Run(error); | 240 return current_expecter_cb_->Run(error); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void Connection::ReportDiagnosticInfo(int extended_error, Statement* stmt) { | 243 void Connection::ReportDiagnosticInfo(int extended_error, Statement* stmt) { |
| 244 AssertIOAllowed(); | 244 AssertIOAllowed(); |
| 245 | 245 |
| 246 // Trim extended error codes. |
| 247 const int error = (extended_error & 0xFF); |
| 246 std::string debug_info; | 248 std::string debug_info; |
| 247 const int error = (extended_error & 0xFF); | |
| 248 if (error == SQLITE_CORRUPT) { | 249 if (error == SQLITE_CORRUPT) { |
| 249 // CollectCorruptionInfo() is implemented in terms of sql::Connection, | 250 // CollectCorruptionInfo() is implemented in terms of sql::Connection, |
| 250 // prevent reentrant calls to the error callback. | 251 // prevent reentrant calls to the error callback. |
| 251 // TODO(shess): Rewrite IntegrityCheckHelper() in terms of raw SQLite. | 252 // TODO(shess): Rewrite IntegrityCheckHelper() in terms of raw SQLite. |
| 252 ErrorCallback original_callback = std::move(error_callback_); | 253 ErrorCallback original_callback = std::move(error_callback_); |
| 253 reset_error_callback(); | 254 reset_error_callback(); |
| 254 | 255 |
| 255 debug_info = CollectCorruptionInfo(); | 256 debug_info = CollectCorruptionInfo(); |
| 256 | 257 |
| 257 error_callback_ = std::move(original_callback); | 258 error_callback_ = std::move(original_callback); |
| (...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 ignore_result(Execute(kNoWritableSchema)); | 1956 ignore_result(Execute(kNoWritableSchema)); |
| 1956 | 1957 |
| 1957 return ret; | 1958 return ret; |
| 1958 } | 1959 } |
| 1959 | 1960 |
| 1960 base::TimeTicks TimeSource::Now() { | 1961 base::TimeTicks TimeSource::Now() { |
| 1961 return base::TimeTicks::Now(); | 1962 return base::TimeTicks::Now(); |
| 1962 } | 1963 } |
| 1963 | 1964 |
| 1964 } // namespace sql | 1965 } // namespace sql |
| OLD | NEW |