sqlite: add SqliteConnectOptions::shared_cache() (#1177)

This makes it possible to open database in shared cache mode without
having to construct `sqlite://` URL with `?cache=shared` flag.
This commit is contained in:
link2xt 2021-04-28 04:35:45 +03:00 committed by GitHub
parent b5928f6e7f
commit 405474b575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,6 +105,14 @@ impl SqliteConnectOptions {
self
}
/// Set the [`SQLITE_OPEN_SHAREDCACHE` flag](https://sqlite.org/sharedcache.html).
///
/// By default, this is disabled.
pub fn shared_cache(mut self, on: bool) -> Self {
self.shared_cache = on;
self
}
/// Sets the [journal mode](https://www.sqlite.org/pragma.html#pragma_journal_mode) for the database connection.
///
/// The default journal mode is WAL. For most use cases this can be significantly faster but