[][src]Trait sqlx::Executor

pub trait Executor: Send {
    type Database: Database;
    fn execute<'e, 'q, 'c, E>(
        &'c mut self,
        query: E
    ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'e + Send>>
    where
        'q: 'e,
        'c: 'e,
        E: 'e + Execute<'q, Self::Database>
;
fn fetch<'q, E>(
        &'e mut self,
        query: E
    ) -> <Self::Database as HasCursor<'e, 'q>>::Cursor
    where
        E: Execute<'q, Self::Database>
; }

A type that contains or can provide a database connection to use for executing queries against the database.

No guarantees are provided that successive queries run on the same physical database connection. A Connection is an Executor that guarantees that successive queries are run on the same physical database connection.

Implementations are provided for &Pool, &mut PoolConnection, and &mut Connection.

Associated Types

type Database: Database

The specific database that this type is implemented for.

Loading content...

Required methods

fn execute<'e, 'q, 'c, E>(
    &'c mut self,
    query: E
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + 'e + Send>> where
    'q: 'e,
    'c: 'e,
    E: 'e + Execute<'q, Self::Database>, 

Executes the query for its side-effects and discarding any potential result rows.

Returns the number of rows affected, or 0 if not applicable.

fn fetch<'q, E>(
    &'e mut self,
    query: E
) -> <Self::Database as HasCursor<'e, 'q>>::Cursor where
    E: Execute<'q, Self::Database>, 

Executes a query for its result.

Returns a Cursor that can be used to iterate through the Rows of the result.

Loading content...

Implementations on Foreign Types

impl<'_, T> Executor for &'_ mut T where
    T: Executor
[src]

type Database = <T as Executor>::Database

Loading content...

Implementors

impl Executor for PgListener[src]

type Database = Postgres

impl Executor for MySqlConnection[src]

type Database = MySql

impl Executor for PgConnection[src]

type Database = Postgres

impl Executor for SqliteConnection[src]

type Database = Sqlite

impl<'p, C, DB> Executor for &'p Pool<C> where
    C: Connect<Database = DB>,
    DB: Database<Connection = C, Database = DB> + HasCursor<'c, 'q>, 
[src]

type Database = DB

impl<C> Executor for PoolConnection<C> where
    C: Connect
[src]

type Database = <C as Executor>::Database

impl<DB, C> Executor for Transaction<C> where
    C: Connection<Database = DB>,
    DB: Database
[src]

type Database = <C as Executor>::Database

Loading content...