| 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 #ifndef SQL_CONNECTION_H_ | 5 #ifndef SQL_CONNECTION_H_ |
| 6 #define SQL_CONNECTION_H_ | 6 #define SQL_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 // Set an error-handling callback. On errors, the error number (and | 119 // Set an error-handling callback. On errors, the error number (and |
| 120 // statement, if available) will be passed to the callback. | 120 // statement, if available) will be passed to the callback. |
| 121 // | 121 // |
| 122 // If no callback is set, the default action is to crash in debug | 122 // If no callback is set, the default action is to crash in debug |
| 123 // mode or return failure in release mode. | 123 // mode or return failure in release mode. |
| 124 typedef base::Callback<void(int, Statement*)> ErrorCallback; | 124 typedef base::Callback<void(int, Statement*)> ErrorCallback; |
| 125 void set_error_callback(const ErrorCallback& callback) { | 125 void set_error_callback(const ErrorCallback& callback) { |
| 126 error_callback_ = callback; | 126 error_callback_ = callback; |
| 127 } | 127 } |
| 128 bool has_error_callback() const { |
| 129 return !error_callback_.is_null(); |
| 130 } |
| 128 void reset_error_callback() { | 131 void reset_error_callback() { |
| 129 error_callback_.Reset(); | 132 error_callback_.Reset(); |
| 130 } | 133 } |
| 131 | 134 |
| 132 // Set this tag to enable additional connection-type histogramming | 135 // Set this tag to enable additional connection-type histogramming |
| 133 // for SQLite error codes and database version numbers. | 136 // for SQLite error codes and database version numbers. |
| 134 void set_histogram_tag(const std::string& tag) { | 137 void set_histogram_tag(const std::string& tag) { |
| 135 histogram_tag_ = tag; | 138 histogram_tag_ = tag; |
| 136 } | 139 } |
| 137 | 140 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 | 516 |
| 514 // Tag for auxiliary histograms. | 517 // Tag for auxiliary histograms. |
| 515 std::string histogram_tag_; | 518 std::string histogram_tag_; |
| 516 | 519 |
| 517 DISALLOW_COPY_AND_ASSIGN(Connection); | 520 DISALLOW_COPY_AND_ASSIGN(Connection); |
| 518 }; | 521 }; |
| 519 | 522 |
| 520 } // namespace sql | 523 } // namespace sql |
| 521 | 524 |
| 522 #endif // SQL_CONNECTION_H_ | 525 #endif // SQL_CONNECTION_H_ |
| OLD | NEW |