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.

All methods are async fn returning futures that complete immediately (sync under the hood). The internal connection I/O is microsecond-level on UDS and fast on TCP; the async signature exists for ergonomic compatibility with async runtimes (tokio, etc.).

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§