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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 int Connection::OnSqliteError(int err, sql::Statement *stmt) { | 794 int Connection::OnSqliteError(int err, sql::Statement *stmt) { |
| 795 UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.Error", err); | 795 UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.Error", err); |
| 796 AddTaggedHistogram("Sqlite.Error", err); | 796 AddTaggedHistogram("Sqlite.Error", err); |
| 797 | 797 |
| 798 // Always log the error. | 798 // Always log the error. |
| 799 LOG(ERROR) << "sqlite error " << err | 799 LOG(ERROR) << "sqlite error " << err |
| 800 << ", errno " << GetLastErrno() | 800 << ", errno " << GetLastErrno() |
| 801 << ": " << GetErrorMessage(); | 801 << ": " << GetErrorMessage(); |
| 802 | 802 |
| 803 if (!error_callback_.is_null()) { | 803 if (!error_callback_.is_null()) { |
| 804 error_callback_.Run(err, stmt); | 804 // Fire from a copy of the callback in case of reentry into |
|
erikwright (departed)
2013/07/05 19:16:55
I would argue that this is a bug in Callback.
Sho
Scott Hess - ex-Googler
2013/07/08 21:15:35
I had logged http://crbug.com/254584 , but since I
| |
| 805 // re/set_error_callback(). | |
| 806 ErrorCallback(error_callback_).Run(err, stmt); | |
| 805 return err; | 807 return err; |
| 806 } | 808 } |
| 807 | 809 |
| 808 // The default handling is to assert on debug and to ignore on release. | 810 // The default handling is to assert on debug and to ignore on release. |
| 809 if (!ShouldIgnore(err)) | 811 if (!ShouldIgnore(err)) |
| 810 DLOG(FATAL) << GetErrorMessage(); | 812 DLOG(FATAL) << GetErrorMessage(); |
| 811 return err; | 813 return err; |
| 812 } | 814 } |
| 813 | 815 |
| 814 // TODO(shess): Allow specifying integrity_check versus quick_check. | 816 // TODO(shess): Allow specifying integrity_check versus quick_check. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 840 } | 842 } |
| 841 | 843 |
| 842 // Best effort to put things back as they were before. | 844 // Best effort to put things back as they were before. |
| 843 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; | 845 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; |
| 844 ignore_result(Execute(kNoWritableSchema)); | 846 ignore_result(Execute(kNoWritableSchema)); |
| 845 | 847 |
| 846 return ret; | 848 return ret; |
| 847 } | 849 } |
| 848 | 850 |
| 849 } // namespace sql | 851 } // namespace sql |
| OLD | NEW |