[−][src]Struct sqlx::sqlite::SqliteConnectOptions
sqlite
only.Options and flags which can be used to configure a SQLite connection.
A value of SqliteConnectOptions
can be parsed from a connection URI,
as described by SQLite.
URI | Description |
---|---|
sqlite::memory: | Open an in-memory database. |
sqlite:data.db | Open the file data.db in the current directory. |
sqlite://data.db | Open the file data.db in the current directory. |
sqlite:///data.db | Open the file data.db from the root (/ ) directory. |
sqlite://data.db?mode=ro | Open the file data.db for read-only access. |
Example
use sqlx::sqlite::{SqliteConnectOptions, SqliteJournalMode}; use std::str::FromStr; let conn = SqliteConnectOptions::from_str("sqlite://data.db")? .journal_mode(SqliteJournalMode::Wal) .read_only(true) .connect().await?;
Implementations
impl SqliteConnectOptions
[src]
pub fn new() -> SqliteConnectOptions
[src]
pub fn filename(self, filename: impl AsRef<Path>) -> SqliteConnectOptions
[src]
Sets the name of the database file.
pub fn foreign_keys(self, on: bool) -> SqliteConnectOptions
[src]
Set the enforcement of foreign key constriants.
By default, this is enabled.
pub fn journal_mode(self, mode: SqliteJournalMode) -> SqliteConnectOptions
[src]
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.
pub fn read_only(self, read_only: bool) -> SqliteConnectOptions
[src]
Sets the access mode to open the database for read-only access.
pub fn create_if_missing(self, create: bool) -> SqliteConnectOptions
[src]
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.
pub fn statement_cache_capacity(self, capacity: usize) -> SqliteConnectOptions
[src]
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.
pub fn busy_timeout(self, timeout: Duration) -> SqliteConnectOptions
[src]
Sets a timeout value to wait when the database is locked, before returning a busy timeout error.
The default busy timeout is 5 seconds.
Trait Implementations
impl Clone for SqliteConnectOptions
[src]
pub fn clone(&self) -> SqliteConnectOptions
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl ConnectOptions for SqliteConnectOptions
[src]
type Connection = SqliteConnection
pub fn connect(
&self
) -> Pin<Box<dyn Future<Output = Result<<SqliteConnectOptions as ConnectOptions>::Connection, Error>> + Send, Global>> where
<SqliteConnectOptions as ConnectOptions>::Connection: Sized,
[src]
&self
) -> Pin<Box<dyn Future<Output = Result<<SqliteConnectOptions as ConnectOptions>::Connection, Error>> + Send, Global>> where
<SqliteConnectOptions as ConnectOptions>::Connection: Sized,
pub fn log_statements(
&mut self,
level: LevelFilter
) -> &mut SqliteConnectOptions
[src]
&mut self,
level: LevelFilter
) -> &mut SqliteConnectOptions
pub fn log_slow_statements(
&mut self,
level: LevelFilter,
duration: Duration
) -> &mut SqliteConnectOptions
[src]
&mut self,
level: LevelFilter,
duration: Duration
) -> &mut SqliteConnectOptions
impl Debug for SqliteConnectOptions
[src]
impl Default for SqliteConnectOptions
[src]
pub fn default() -> SqliteConnectOptions
[src]
impl From<SqliteConnectOptions> for AnyConnectOptions
[src]
pub fn from(options: SqliteConnectOptions) -> AnyConnectOptions
[src]
impl FromStr for SqliteConnectOptions
[src]
type Err = Error
The associated error which can be returned from parsing.
pub fn from_str(
uri: &str
) -> Result<SqliteConnectOptions, <SqliteConnectOptions as FromStr>::Err>
[src]
uri: &str
) -> Result<SqliteConnectOptions, <SqliteConnectOptions as FromStr>::Err>
Auto Trait Implementations
impl RefUnwindSafe for SqliteConnectOptions
impl Send for SqliteConnectOptions
impl Sync for SqliteConnectOptions
impl Unpin for SqliteConnectOptions
impl UnwindSafe for SqliteConnectOptions
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,