Chromium Code Reviews| 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 <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1020 base::HistogramBase::kUmaTargetedHistogramFlag); | 1020 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 1021 if (histogram) | 1021 if (histogram) |
| 1022 histogram->Add(sample); | 1022 histogram->Add(sample); |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 int Connection::OnSqliteError(int err, sql::Statement *stmt) { | 1025 int Connection::OnSqliteError(int err, sql::Statement *stmt) { |
| 1026 UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.Error", err); | 1026 UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.Error", err); |
| 1027 AddTaggedHistogram("Sqlite.Error", err); | 1027 AddTaggedHistogram("Sqlite.Error", err); |
| 1028 | 1028 |
| 1029 // Always log the error. | 1029 // Always log the error. |
| 1030 LOG(ERROR) << "sqlite error " << err | 1030 LOG(ERROR) << histogram_tag_ << " sqlite error " << err |
|
Greg Spencer (Chromium)
2013/09/25 18:36:30
Would it make sense to use sqlite3_column_database
Scott Hess - ex-Googler
2013/09/25 19:37:04
http://www.sqlite.org/c3ref/column_database_name.h
| |
| 1031 << ", errno " << GetLastErrno() | 1031 << ", errno " << GetLastErrno() |
| 1032 << ": " << GetErrorMessage(); | 1032 << ": " << GetErrorMessage(); |
| 1033 | 1033 |
| 1034 if (!error_callback_.is_null()) { | 1034 if (!error_callback_.is_null()) { |
| 1035 // Fire from a copy of the callback in case of reentry into | 1035 // Fire from a copy of the callback in case of reentry into |
| 1036 // re/set_error_callback(). | 1036 // re/set_error_callback(). |
| 1037 // TODO(shess): <http://crbug.com/254584> | 1037 // TODO(shess): <http://crbug.com/254584> |
| 1038 ErrorCallback(error_callback_).Run(err, stmt); | 1038 ErrorCallback(error_callback_).Run(err, stmt); |
| 1039 return err; | 1039 return err; |
| 1040 } | 1040 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 // Best effort to put things back as they were before. | 1076 // Best effort to put things back as they were before. |
| 1077 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; | 1077 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; |
| 1078 ignore_result(Execute(kNoWritableSchema)); | 1078 ignore_result(Execute(kNoWritableSchema)); |
| 1079 | 1079 |
| 1080 return ret; | 1080 return ret; |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 } // namespace sql | 1083 } // namespace sql |
| OLD | NEW |