Skip to content

Commit

Permalink
sqlite: add SqliteConnectOptions::shared_cache() (#1177)
Browse files Browse the repository at this point in the history
This makes it possible to open database in shared cache mode without
having to construct `sqlite://` URL with `?cache=shared` flag.
  • Loading branch information
link2xt authored Apr 28, 2021
1 parent b5928f6 commit 405474b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sqlx-core/src/sqlite/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 405474b

Please sign in to comment.