[][src]Trait sqlx_core::executor::Executor

pub trait Executor<'c>: Send + Debug + Sized {
    type Database: Database;
    pub fn fetch_many<'e, 'q: 'e, E: 'q>(
        self,
        query: E
    ) -> BoxStream<'e, Result<Either<<Self::Database as Database>::Done, <Self::Database as Database>::Row>, Error>>
    where
        'c: 'e,
        E: Execute<'q, Self::Database>
;
pub fn fetch_optional<'e, 'q: 'e, E: 'q>(
        self,
        query: E
    ) -> BoxFuture<'e, Result<Option<<Self::Database as Database>::Row>, Error>>
    where
        'c: 'e,
        E: Execute<'q, Self::Database>
;
pub fn prepare_with<'e, 'q: 'e>(
        self,
        sql: &'q str,
        parameters: &'e [<Self::Database as Database>::TypeInfo]
    ) -> BoxFuture<'e, Result<<Self::Database as HasStatement<'q>>::Statement, Error>>
    where
        'c: 'e
; pub fn execute<'e, 'q: 'e, E: 'q>(
        self,
        query: E
    ) -> BoxFuture<'e, Result<<Self::Database as Database>::Done, Error>>
    where
        'c: 'e,
        E: Execute<'q, Self::Database>
, { ... }
pub fn execute_many<'e, 'q: 'e, E: 'q>(
        self,
        query: E
    ) -> BoxStream<'e, Result<<Self::Database as Database>::Done, Error>>
    where
        'c: 'e,
        E: Execute<'q, Self::Database>
, { ... }
pub fn fetch<'e, 'q: 'e, E: 'q>(
        self,
        query: E
    ) -> BoxStream<'e, Result<<Self::Database as Database>::Row, Error>>
    where
        'c: 'e,
        E: Execute<'q, Self::Database>
, { ... }
pub fn fetch_all<'e, 'q: 'e, E: 'q>(
        self,
        query: E
    ) -> BoxFuture<'e, Result<Vec<<Self::Database as Database>::Row>, Error>>
    where
        'c: 'e,
        E: Execute<'q, Self::Database>
, { ... }
pub fn fetch_one<'e, 'q: 'e, E: 'q>(
        self,
        query: E
    ) -> BoxFuture<'e, Result<<Self::Database as Database>::Row, Error>>
    where
        'c: 'e,
        E: Execute<'q, Self::Database>
, { ... }
pub fn prepare<'e, 'q: 'e>(
        self,
        query: &'q str
    ) -> BoxFuture<'e, Result<<Self::Database as HasStatement<'q>>::Statement, Error>>
    where
        'c: 'e
, { ... } }

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 ran on the same physical database connection.

Implemented for the following:

Associated Types

Loading content...

Required methods

pub fn fetch_many<'e, 'q: 'e, E: 'q>(
    self,
    query: E
) -> BoxStream<'e, Result<Either<<Self::Database as Database>::Done, <Self::Database as Database>::Row>, Error>> where
    'c: 'e,
    E: Execute<'q, Self::Database>, 
[src]

Execute multiple queries and return the generated results as a stream from each query, in a stream.

pub fn fetch_optional<'e, 'q: 'e, E: 'q>(
    self,
    query: E
) -> BoxFuture<'e, Result<Option<<Self::Database as Database>::Row>, Error>> where
    'c: 'e,
    E: Execute<'q, Self::Database>, 
[src]

Execute the query and returns at most one row.

pub fn prepare_with<'e, 'q: 'e>(
    self,
    sql: &'q str,
    parameters: &'e [<Self::Database as Database>::TypeInfo]
) -> BoxFuture<'e, Result<<Self::Database as HasStatement<'q>>::Statement, Error>> where
    'c: 'e, 
[src]

Prepare the SQL query, with parameter type information, to inspect the type information about its parameters and results.

Only some database drivers (PostgreSQL, MSSQL) can take advantage of this extra information to influence parameter type inference.

Loading content...

Provided methods

pub fn execute<'e, 'q: 'e, E: 'q>(
    self,
    query: E
) -> BoxFuture<'e, Result<<Self::Database as Database>::Done, Error>> where
    'c: 'e,
    E: Execute<'q, Self::Database>, 
[src]

Execute the query and return the total number of rows affected.

pub fn execute_many<'e, 'q: 'e, E: 'q>(
    self,
    query: E
) -> BoxStream<'e, Result<<Self::Database as Database>::Done, Error>> where
    'c: 'e,
    E: Execute<'q, Self::Database>, 
[src]

Execute multiple queries and return the rows affected from each query, in a stream.

pub fn fetch<'e, 'q: 'e, E: 'q>(
    self,
    query: E
) -> BoxStream<'e, Result<<Self::Database as Database>::Row, Error>> where
    'c: 'e,
    E: Execute<'q, Self::Database>, 
[src]

Execute the query and return the generated results as a stream.

pub fn fetch_all<'e, 'q: 'e, E: 'q>(
    self,
    query: E
) -> BoxFuture<'e, Result<Vec<<Self::Database as Database>::Row>, Error>> where
    'c: 'e,
    E: Execute<'q, Self::Database>, 
[src]

Execute the query and return all the generated results, collected into a Vec.

pub fn fetch_one<'e, 'q: 'e, E: 'q>(
    self,
    query: E
) -> BoxFuture<'e, Result<<Self::Database as Database>::Row, Error>> where
    'c: 'e,
    E: Execute<'q, Self::Database>, 
[src]

Execute the query and returns exactly one row.

pub fn prepare<'e, 'q: 'e>(
    self,
    query: &'q str
) -> BoxFuture<'e, Result<<Self::Database as HasStatement<'q>>::Statement, Error>> where
    'c: 'e, 
[src]

Prepare the SQL query to inspect the type information of its parameters and results.

Be advised that when using the query, query_as, or query_scalar functions, the query is transparently prepared and executed.

This explicit API is provided to allow access to the statement metadata available after it prepared but before the first row is returned.

Loading content...

Implementors

impl<'c> Executor<'c> for &'c mut AnyConnection[src]

type Database = Any

impl<'c> Executor<'c> for &'c mut MssqlConnection[src]

type Database = Mssql

impl<'c> Executor<'c> for &'c mut MySqlConnection[src]

type Database = MySql

impl<'c> Executor<'c> for &'c mut PoolConnection<Any>[src]

type Database = Any

impl<'c> Executor<'c> for &'c mut PoolConnection<Mssql>[src]

type Database = Mssql

impl<'c> Executor<'c> for &'c mut PoolConnection<MySql>[src]

type Database = MySql

impl<'c> Executor<'c> for &'c mut PoolConnection<Postgres>[src]

type Database = Postgres

impl<'c> Executor<'c> for &'c mut PoolConnection<Sqlite>[src]

type Database = Sqlite

impl<'c> Executor<'c> for &'c mut PgConnection[src]

type Database = Postgres

impl<'c> Executor<'c> for &'c mut PgListener[src]

type Database = Postgres

impl<'c> Executor<'c> for &'c mut SqliteConnection[src]

type Database = Sqlite

impl<'c, 't> Executor<'t> for &'t mut Transaction<'c, Any>[src]

type Database = Any

impl<'c, 't> Executor<'t> for &'t mut Transaction<'c, Mssql>[src]

type Database = Mssql

impl<'c, 't> Executor<'t> for &'t mut Transaction<'c, MySql>[src]

type Database = MySql

impl<'c, 't> Executor<'t> for &'t mut Transaction<'c, Postgres>[src]

type Database = Postgres

impl<'c, 't> Executor<'t> for &'t mut Transaction<'c, Sqlite>[src]

type Database = Sqlite

impl<'p, DB: Database, '_> Executor<'p> for &'_ Pool<DB> where
    &'c mut DB::Connection: Executor<'c, Database = DB>, 
[src]

type Database = DB

Loading content...