pub struct SqliteConnectOptions { /* private fields */ }
Implementations§
Source§impl SqliteConnectOptions
impl SqliteConnectOptions
pub fn new() -> Self
Sourcepub fn foreign_keys(self, on: bool) -> Self
pub fn foreign_keys(self, on: bool) -> Self
Set the enforcement of foreign key constraints.
By default, this is enabled.
Sourcepub fn journal_mode(self, mode: SqliteJournalMode) -> Self
pub fn journal_mode(self, mode: SqliteJournalMode) -> Self
Sets the journal mode for the database connection.
The default journal mode is WAL. For most use cases this can be significantly faster but there are disadvantages.
Sourcepub fn locking_mode(self, mode: SqliteLockingMode) -> Self
pub fn locking_mode(self, mode: SqliteLockingMode) -> Self
Sets the locking mode for the database connection.
The default locking mode is NORMAL.
Sourcepub fn read_only(self, read_only: bool) -> Self
pub fn read_only(self, read_only: bool) -> Self
Sets the access mode to open the database for read-only access.
Sourcepub fn create_if_missing(self, create: bool) -> Self
pub fn create_if_missing(self, create: bool) -> Self
Sets the access mode to create the database file if the file does not exist.
By default, a new file will not be created if one is not found.
Sourcepub fn statement_cache_capacity(self, capacity: usize) -> Self
pub fn statement_cache_capacity(self, capacity: usize) -> Self
Sets the capacity of the connection’s statement cache in a number of stored distinct statements. Caching is handled using LRU, meaning when the amount of queries hits the defined limit, the oldest statement will get dropped.
The default cache capacity is 100 statements.
Sourcepub fn busy_timeout(self, timeout: Duration) -> Self
pub fn busy_timeout(self, timeout: Duration) -> Self
Sets a timeout value to wait when the database is locked, before returning a busy timeout error.
The default busy timeout is 5 seconds.
Sourcepub fn synchronous(self, synchronous: SqliteSynchronous) -> Self
pub fn synchronous(self, synchronous: SqliteSynchronous) -> Self
Sets the synchronous setting for the database connection.
The default synchronous settings is FULL. However, if durability is not a concern, then NORMAL is normally all one needs in WAL mode.
Sourcepub fn auto_vacuum(self, auto_vacuum: SqliteAutoVacuum) -> Self
pub fn auto_vacuum(self, auto_vacuum: SqliteAutoVacuum) -> Self
Sets the auto_vacuum setting for the database connection.
The default auto_vacuum setting is NONE.
Set the SQLITE_OPEN_SHAREDCACHE
flag.
By default, this is disabled.
Trait Implementations§
Source§impl Clone for SqliteConnectOptions
impl Clone for SqliteConnectOptions
Source§fn clone(&self) -> SqliteConnectOptions
fn clone(&self) -> SqliteConnectOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more