mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
* SqliteConnectOptions::filename() memory fix (#3136) * Expose in_memory sqlite option * Docs SqliteConnectOptions::filename include mention of from_str alternative * Docs SqliteConnectOptions::filename typo fix
This commit is contained in:
parent
c57b46ceb6
commit
2df770a10b
1 changed files with 12 additions and 0 deletions
|
@ -210,6 +210,10 @@ impl SqliteConnectOptions {
|
|||
}
|
||||
|
||||
/// Sets the name of the database file.
|
||||
///
|
||||
/// This is a low-level API, and SQLx will apply no special treatment for `":memory:"` as an
|
||||
/// in-memory database using this method. Using [SqliteConnectOptions::from_str] may be
|
||||
/// preferred for simple use cases.
|
||||
pub fn filename(mut self, filename: impl AsRef<Path>) -> Self {
|
||||
self.filename = Cow::Owned(filename.as_ref().to_owned());
|
||||
self
|
||||
|
@ -228,6 +232,14 @@ impl SqliteConnectOptions {
|
|||
self.pragma("foreign_keys", if on { "ON" } else { "OFF" })
|
||||
}
|
||||
|
||||
/// Set the [`SQLITE_OPEN_MEMORY` flag](https://sqlite.org/c3ref/open.html).
|
||||
///
|
||||
/// By default, this is disabled.
|
||||
pub fn in_memory(mut self, in_memory: bool) -> Self {
|
||||
self.in_memory = in_memory;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the [`SQLITE_OPEN_SHAREDCACHE` flag](https://sqlite.org/sharedcache.html).
|
||||
///
|
||||
/// By default, this is disabled.
|
||||
|
|
Loading…
Reference in a new issue