Struct sqlite_bindings_lunatic::Connection
source · pub struct Connection { /* private fields */ }
Expand description
A database connection.
Implementations§
source§impl Connection
impl Connection
sourcepub fn open<T: AsRef<Path>>(path: T) -> Result<Connection>
pub fn open<T: AsRef<Path>>(path: T) -> Result<Connection>
Open a read-write connection to a new or existing database.
sourcepub fn open_with_flags<T: AsRef<Path>>(
path: T,
flags: OpenFlags
) -> Result<Connection>
pub fn open_with_flags<T: AsRef<Path>>(
path: T,
flags: OpenFlags
) -> Result<Connection>
Open a connection with specific flags.
sourcepub fn open_with_full_mutex<T: AsRef<Path>>(
path: T
) -> Result<ConnectionWithFullMutex>
pub fn open_with_full_mutex<T: AsRef<Path>>(
path: T
) -> Result<ConnectionWithFullMutex>
Open a thread-safe read-write connection to a new or existing database.
sourcepub fn execute<T: AsRef<str>>(&self, statement: T) -> Result<()>
pub fn execute<T: AsRef<str>>(&self, statement: T) -> Result<()>
Execute a statement without processing the resulting rows if any.
sourcepub fn iterate<T: AsRef<str>, F>(&self, statement: T, callback: F) -> Result<()>where
F: FnMut(&[(&str, Option<&str>)]) -> bool,
pub fn iterate<T: AsRef<str>, F>(&self, statement: T, callback: F) -> Result<()>where
F: FnMut(&[(&str, Option<&str>)]) -> bool,
Execute a statement and process the resulting rows as plain text.
The callback is triggered for each row. If the callback returns false
,
no more rows will be processed. For large queries and non-string data
types, prepared statement are highly preferable; see prepare
.
sourcepub fn prepare<'l, T: AsRef<str>>(&'l self, statement: T) -> Result<Statement>
pub fn prepare<'l, T: AsRef<str>>(&'l self, statement: T) -> Result<Statement>
Create a prepared statement.
sourcepub fn change_count(&self) -> usize
pub fn change_count(&self) -> usize
Return the number of rows inserted, updated, or deleted by the most recent INSERT, UPDATE, or DELETE statement.
sourcepub fn total_change_count(&self) -> usize
pub fn total_change_count(&self) -> usize
Return the total number of rows inserted, updated, and deleted by all INSERT, UPDATE, and DELETE statements since the connection was opened.
sourcepub fn set_busy_handler<F>(&mut self, callback: F) -> Result<()>where
F: FnMut(usize) -> bool + Send + 'static,
pub fn set_busy_handler<F>(&mut self, callback: F) -> Result<()>where
F: FnMut(usize) -> bool + Send + 'static,
Set a callback for handling busy events.
The callback is triggered when the database cannot perform an operation
due to processing of some other request. If the callback returns true
,
the operation will be repeated.
sourcepub fn set_busy_timeout(&mut self, milliseconds: usize) -> Result<()>
pub fn set_busy_timeout(&mut self, milliseconds: usize) -> Result<()>
Set an implicit callback for handling busy events that tries to repeat rejected operations until a timeout expires.
sourcepub fn remove_busy_handler(&mut self) -> Result<()>
pub fn remove_busy_handler(&mut self) -> Result<()>
Remove the callback handling busy events.