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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <map> | 10 #include <map> |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // | 142 // |
143 // This must be called before Open() to have an effect. | 143 // This must be called before Open() to have an effect. |
144 void set_exclusive_locking() { exclusive_locking_ = true; } | 144 void set_exclusive_locking() { exclusive_locking_ = true; } |
145 | 145 |
146 // Call to cause Open() to restrict access permissions of the | 146 // Call to cause Open() to restrict access permissions of the |
147 // database file to only the owner. | 147 // database file to only the owner. |
148 // TODO(shess): Currently only supported on OS_POSIX, is a noop on | 148 // TODO(shess): Currently only supported on OS_POSIX, is a noop on |
149 // other platforms. | 149 // other platforms. |
150 void set_restrict_to_user() { restrict_to_user_ = true; } | 150 void set_restrict_to_user() { restrict_to_user_ = true; } |
151 | 151 |
152 // Call to opt out of memory-mapped file I/O. | 152 // Call to opt out of memory-mapped file I/O on per connection basis. |
153 void set_mmap_disabled() { mmap_disabled_ = true; } | 153 void set_mmap_disabled() { mmap_disabled_ = true; } |
154 | 154 |
| 155 // Call to opt out of memory-mapped file I/O on all connections. |
| 156 static void set_mmap_disabled_by_default(); |
| 157 |
155 // Set an error-handling callback. On errors, the error number (and | 158 // Set an error-handling callback. On errors, the error number (and |
156 // statement, if available) will be passed to the callback. | 159 // statement, if available) will be passed to the callback. |
157 // | 160 // |
158 // If no callback is set, the default action is to crash in debug | 161 // If no callback is set, the default action is to crash in debug |
159 // mode or return failure in release mode. | 162 // mode or return failure in release mode. |
160 typedef base::Callback<void(int, Statement*)> ErrorCallback; | 163 typedef base::Callback<void(int, Statement*)> ErrorCallback; |
161 void set_error_callback(const ErrorCallback& callback) { | 164 void set_error_callback(const ErrorCallback& callback) { |
162 error_callback_ = callback; | 165 error_callback_ = callback; |
163 } | 166 } |
164 bool has_error_callback() const { | 167 bool has_error_callback() const { |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 | 796 |
794 // Stores the dump provider object when db is open. | 797 // Stores the dump provider object when db is open. |
795 scoped_ptr<ConnectionMemoryDumpProvider> memory_dump_provider_; | 798 scoped_ptr<ConnectionMemoryDumpProvider> memory_dump_provider_; |
796 | 799 |
797 DISALLOW_COPY_AND_ASSIGN(Connection); | 800 DISALLOW_COPY_AND_ASSIGN(Connection); |
798 }; | 801 }; |
799 | 802 |
800 } // namespace sql | 803 } // namespace sql |
801 | 804 |
802 #endif // SQL_CONNECTION_H_ | 805 #endif // SQL_CONNECTION_H_ |
OLD | NEW |