[−][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]
sqlite
only.pub fn filename(self, filename: impl AsRef<Path>) -> SqliteConnectOptions
[src]
sqlite
only.Sets the name of the database file.
pub fn foreign_keys(self, on: bool) -> SqliteConnectOptions
[src]
sqlite
only.Set the enforcement of foreign key constriants.
By default, this is enabled.
pub fn journal_mode(self, mode: SqliteJournalMode) -> SqliteConnectOptions
[src]
sqlite
only.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]
sqlite
only.Sets the access mode to open the database for read-only access.
pub fn create_if_missing(self, create: bool) -> SqliteConnectOptions
[src]
sqlite
only.Sets the access mode to create the database file if the file does not exist.
By default, a new file will be created if one is not found.
pub fn statement_cache_capacity(self, capacity: usize) -> SqliteConnectOptions
[src]
sqlite
only.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.
Trait Implementations
impl Clone for SqliteConnectOptions
[src]
fn clone(&self) -> SqliteConnectOptions
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl ConnectOptions for SqliteConnectOptions
[src]
type Connection = SqliteConnection
fn connect(
&self
) -> Pin<Box<dyn Future<Output = Result<<SqliteConnectOptions as ConnectOptions>::Connection, Error>> + Send>> where
<SqliteConnectOptions as ConnectOptions>::Connection: Sized,
[src]
&self
) -> Pin<Box<dyn Future<Output = Result<<SqliteConnectOptions as ConnectOptions>::Connection, Error>> + Send>> where
<SqliteConnectOptions as ConnectOptions>::Connection: Sized,
impl Debug for SqliteConnectOptions
[src]
impl Default for SqliteConnectOptions
[src]
fn default() -> SqliteConnectOptions
[src]
impl FromStr for SqliteConnectOptions
[src]
type Err = Error
The associated error which can be returned from parsing.
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,
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.
fn to_owned(&self) -> T
[src]
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.
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.
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>,