Skip to main content

DriverConnection

Trait DriverConnection 

Source
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§

Source

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.

Source

fn simple_query<'a>( &'a mut self, sql: &'a str, ) -> BoxFuture<'a, Result<QueryResult>>

Run a statement with no parameters — DDL, and transaction control.

Source

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.

Source

fn in_transaction(&self) -> bool

Whether a transaction is still open. A connection left inside one must never go back into rotation.

Source

fn close(self: Box<Self>) -> BoxFuture<'static, ()>

Say goodbye politely, then hang up.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§