pub trait DriverConnection: Send {
// Required methods
fn query<'a>(
&'a mut self,
sql: &'a str,
params: &'a [Value],
) -> BoxFuture<'a, Result<QueryResult>>;
fn simple_query<'a>(
&'a mut self,
sql: &'a str,
) -> BoxFuture<'a, Result<QueryResult>>;
fn is_broken(&self) -> bool;
fn in_transaction(&self) -> bool;
fn close(self: Box<Self>) -> BoxFuture<'static, ()>;
}Expand description
One physical connection.
Required Methods§
Sourcefn query<'a>(
&'a mut self,
sql: &'a str,
params: &'a [Value],
) -> BoxFuture<'a, Result<QueryResult>>
fn query<'a>( &'a mut self, sql: &'a str, params: &'a [Value], ) -> BoxFuture<'a, Result<QueryResult>>
Run a statement with bound parameters.
Parameters never enter the SQL text, whatever the database: that is what makes injection structurally impossible rather than a matter of remembering to escape.
Sourcefn simple_query<'a>(
&'a mut self,
sql: &'a str,
) -> BoxFuture<'a, Result<QueryResult>>
fn simple_query<'a>( &'a mut self, sql: &'a str, ) -> BoxFuture<'a, Result<QueryResult>>
Run a statement with no parameters — DDL, and transaction control.
Sourcefn is_broken(&self) -> bool
fn is_broken(&self) -> bool
Whether this connection is known to be unusable, so the pool discards it instead of handing it to the next caller.
Sourcefn in_transaction(&self) -> bool
fn in_transaction(&self) -> bool
Whether a transaction is still open. A connection left inside one must never go back into rotation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".