Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: sql/connection.cc

Issue 17726002: [sql] Callback and scoped-ignore tests for sql::Statement. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: prevent nesting, TODO. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sql/connection.h ('k') | sql/connection_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 int Connection::OnSqliteError(int err, sql::Statement *stmt) { 853 int Connection::OnSqliteError(int err, sql::Statement *stmt) {
854 UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.Error", err); 854 UMA_HISTOGRAM_SPARSE_SLOWLY("Sqlite.Error", err);
855 AddTaggedHistogram("Sqlite.Error", err); 855 AddTaggedHistogram("Sqlite.Error", err);
856 856
857 // Always log the error. 857 // Always log the error.
858 LOG(ERROR) << "sqlite error " << err 858 LOG(ERROR) << "sqlite error " << err
859 << ", errno " << GetLastErrno() 859 << ", errno " << GetLastErrno()
860 << ": " << GetErrorMessage(); 860 << ": " << GetErrorMessage();
861 861
862 if (!error_callback_.is_null()) { 862 if (!error_callback_.is_null()) {
863 error_callback_.Run(err, stmt); 863 // Fire from a copy of the callback in case of reentry into
864 // re/set_error_callback().
865 // TODO(shess): <http://crbug.com/254584>
866 ErrorCallback(error_callback_).Run(err, stmt);
864 return err; 867 return err;
865 } 868 }
866 869
867 // The default handling is to assert on debug and to ignore on release. 870 // The default handling is to assert on debug and to ignore on release.
868 if (!ShouldIgnore(err)) 871 if (!ShouldIgnore(err))
869 DLOG(FATAL) << GetErrorMessage(); 872 DLOG(FATAL) << GetErrorMessage();
870 return err; 873 return err;
871 } 874 }
872 875
873 // TODO(shess): Allow specifying integrity_check versus quick_check. 876 // TODO(shess): Allow specifying integrity_check versus quick_check.
(...skipping 25 matching lines...) Expand all
899 } 902 }
900 903
901 // Best effort to put things back as they were before. 904 // Best effort to put things back as they were before.
902 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; 905 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF";
903 ignore_result(Execute(kNoWritableSchema)); 906 ignore_result(Execute(kNoWritableSchema));
904 907
905 return ret; 908 return ret;
906 } 909 }
907 910
908 } // namespace sql 911 } // namespace sql
OLDNEW
« no previous file with comments | « sql/connection.h ('k') | sql/connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698