pub trait SqliteConnection: 'static {
// Required methods
fn execute(&mut self, sql: &str, params: &[Value]) -> Result<u64, DbError>;
fn query(
&mut self,
sql: &str,
params: &[Value],
row: &mut dyn FnMut(&dyn Row),
) -> Result<(), DbError>;
// Provided methods
fn begin(&mut self) -> Result<(), DbError> { ... }
fn commit(&mut self) -> Result<(), DbError> { ... }
fn rollback(&mut self) -> Result<(), DbError> { ... }
fn execute_batch(&mut self, sql: &str) -> Result<(), DbError> { ... }
fn query_named(
&mut self,
sql: &str,
params: &[Value],
row: &mut dyn FnMut(&[String], &dyn Row),
) -> Result<(), DbError> { ... }
}Expand description
One open connection. Everything above speaks plain SQL and Values through it.
Required Methods§
Provided Methods§
Sourcefn execute_batch(&mut self, sql: &str) -> Result<(), DbError>
fn execute_batch(&mut self, sql: &str) -> Result<(), DbError>
Several statements in one string, no parameters: a DDL script, a migration step (day-lite’s storage speaks this). The default runs the string as one statement; drivers whose engine executes scripts override it (the built-in native driver does).
§Errors
Returns the engine’s error of the first statement that fails.
Sourcefn query_named(
&mut self,
sql: &str,
params: &[Value],
row: &mut dyn FnMut(&[String], &dyn Row),
) -> Result<(), DbError>
fn query_named( &mut self, sql: &str, params: &[Value], row: &mut dyn FnMut(&[String], &dyn Row), ) -> Result<(), DbError>
SqliteConnection::query, with the result’s column names alongside each row, for
callers that surface rows as named objects (day-lite’s JS bridge). A driver that
cannot name columns refuses rather than guessing.
§Errors
Returns the engine’s error when the statement fails, or an error from a driver that cannot name columns.
Trait Implementations§
Source§impl SqliteConnection for Box<dyn SqliteConnection>
impl SqliteConnection for Box<dyn SqliteConnection>
Source§fn execute(&mut self, sql: &str, params: &[Value]) -> Result<u64, DbError>
fn execute(&mut self, sql: &str, params: &[Value]) -> Result<u64, DbError>
Source§fn query(
&mut self,
sql: &str,
params: &[Value],
row: &mut dyn FnMut(&dyn Row),
) -> Result<(), DbError>
fn query( &mut self, sql: &str, params: &[Value], row: &mut dyn FnMut(&dyn Row), ) -> Result<(), DbError>
row. Read moreSource§fn execute_batch(&mut self, sql: &str) -> Result<(), DbError>
fn execute_batch(&mut self, sql: &str) -> Result<(), DbError>
Source§fn query_named(
&mut self,
sql: &str,
params: &[Value],
row: &mut dyn FnMut(&[String], &dyn Row),
) -> Result<(), DbError>
fn query_named( &mut self, sql: &str, params: &[Value], row: &mut dyn FnMut(&[String], &dyn Row), ) -> Result<(), DbError>
SqliteConnection::query, with the result’s column names alongside each row, for
callers that surface rows as named objects (day-lite’s JS bridge). A driver that
cannot name columns refuses rather than guessing. Read moreDyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".