Skip to main content

Executor

Trait Executor 

Source
pub trait Executor {
    // Required methods
    fn query_raw(
        &self,
        sql: &str,
        sql_hash: u64,
        params: &[&(dyn Encode + Sync)],
    ) -> BsqlResult<OwnedResult>;
    fn query_raw_readonly(
        &self,
        sql: &str,
        sql_hash: u64,
        params: &[&(dyn Encode + Sync)],
    ) -> BsqlResult<OwnedResult>;
    fn execute_raw(
        &self,
        sql: &str,
        sql_hash: u64,
        params: &[&(dyn Encode + Sync)],
    ) -> BsqlResult<u64>;
}
Expand description

Execute a prepared query and return rows.

The generated code calls query_raw, query_raw_readonly, and execute_raw on &Pool, &PoolConnection, or &Transaction.

When the async feature is enabled and the pool connects via TCP, acquire_async() returns true async connections that use tokio I/O instead of blocking the worker thread. UDS connections remain sync (sub-millisecond, acceptable for tokio).

Required Methods§

Source

fn query_raw( &self, sql: &str, sql_hash: u64, params: &[&(dyn Encode + Sync)], ) -> BsqlResult<OwnedResult>

Execute a query and return all rows.

Source

fn query_raw_readonly( &self, sql: &str, sql_hash: u64, params: &[&(dyn Encode + Sync)], ) -> BsqlResult<OwnedResult>

Execute a read-only query. May route to replicas in the future.

Source

fn execute_raw( &self, sql: &str, sql_hash: u64, params: &[&(dyn Encode + Sync)], ) -> BsqlResult<u64>

Execute a query and return the number of affected rows.

Implementors§

Source§

impl Executor for Pool

Available on non-crate feature async only.

When async feature is NOT enabled, use plain sync acquire() + query().

Source§

impl Executor for PoolConnection

Source§

impl Executor for Transaction