summaryrefslogtreecommitdiffstats
path: root/sql/connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/connection.h')
-rw-r--r--sql/connection.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/connection.h b/sql/connection.h
index 19592d9..d456b6c 100644
--- a/sql/connection.h
+++ b/sql/connection.h
@@ -146,6 +146,9 @@ class SQL_EXPORT Connection {
// other platforms.
void set_restrict_to_user() { restrict_to_user_ = true; }
+ // Call to opt out of memory-mapped file I/O.
+ void set_mmap_disabled() { mmap_disabled_ = true; }
+
// Set an error-handling callback. On errors, the error number (and
// statement, if available) will be passed to the callback.
//
@@ -638,6 +641,12 @@ class SQL_EXPORT Connection {
return clock_->Now();
}
+ // Release page-cache memory if memory-mapped I/O is enabled and the database
+ // was changed. Passing true for |implicit_change_performed| allows
+ // overriding the change detection for cases like DDL (CREATE, DROP, etc),
+ // which do not participate in the total-rows-changed tracking.
+ void ReleaseCacheMemoryIfNeeded(bool implicit_change_performed);
+
// The actual sqlite database. Will be NULL before Init has been called or if
// Init resulted in an error.
sqlite3* db_;
@@ -679,6 +688,17 @@ class SQL_EXPORT Connection {
// databases.
bool poisoned_;
+ // |true| if SQLite memory-mapped I/O is not desired for this connection.
+ bool mmap_disabled_;
+
+ // |true| if SQLite memory-mapped I/O was enabled for this connection.
+ // Used by ReleaseCacheMemoryIfNeeded().
+ bool mmap_enabled_;
+
+ // Used by ReleaseCacheMemoryIfNeeded() to track if new changes have happened
+ // since memory was last released.
+ int total_changes_at_last_release_;
+
ErrorCallback error_callback_;
// Tag for auxiliary histograms.