Skip to main content

SqlExecutor

Trait SqlExecutor 

Source
pub trait SqlExecutor {
    type Row;

    // Required methods
    fn execute<'a>(
        &'a mut self,
        statement: SqlStatement,
    ) -> AdapterFuture<'a, u64>;
    fn fetch_all<'a>(
        &'a mut self,
        statement: SqlStatement,
    ) -> AdapterFuture<'a, Vec<Self::Row>>;
    fn fetch_optional<'a>(
        &'a mut self,
        statement: SqlStatement,
    ) -> AdapterFuture<'a, Option<Self::Row>>;
    fn fetch_scalar_i64<'a>(
        &'a mut self,
        statement: SqlStatement,
    ) -> AdapterFuture<'a, i64>;
}
Expand description

Minimal async execution boundary required by the shared SQL runner.

Adapter crates implement this trait for their driver/pool/transaction context. The shared layer owns SQL planning, while this trait owns only driver execution and returning raw driver rows.

Required Associated Types§

Source

type Row

Driver-specific row type returned by fetch operations.

Required Methods§

Source

fn execute<'a>(&'a mut self, statement: SqlStatement) -> AdapterFuture<'a, u64>

Executes a statement that does not need decoded rows and returns affected rows.

Source

fn fetch_all<'a>( &'a mut self, statement: SqlStatement, ) -> AdapterFuture<'a, Vec<Self::Row>>

Fetches all rows produced by a read statement.

Source

fn fetch_optional<'a>( &'a mut self, statement: SqlStatement, ) -> AdapterFuture<'a, Option<Self::Row>>

Fetches at most one row produced by a read statement.

Source

fn fetch_scalar_i64<'a>( &'a mut self, statement: SqlStatement, ) -> AdapterFuture<'a, i64>

Fetches a single signed integer scalar, used by count queries.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§