Skip to main content

QueryRunner

Trait QueryRunner 

Source
pub trait QueryRunner: Send + Sync {
    // Required methods
    fn run_query(
        &self,
        sql: &str,
        max_rows: u64,
        profile: Option<&str>,
    ) -> Result<QueryRows, String>;
    fn columns(
        &self,
        sql: &str,
        profile: Option<&str>,
    ) -> Result<Vec<Column>, String>;

    // Provided method
    fn load(
        &self,
        _name: &str,
        _table: &Table,
    ) -> Result<Option<(String, Option<String>)>, String> { ... }
}
Expand description

Executes run_query() SQL on the Binding’s sessions: on profile’s connection, else on the renderer’s own.

Required Methods§

Source

fn run_query( &self, sql: &str, max_rows: u64, profile: Option<&str>, ) -> Result<QueryRows, String>

Run sql, failing if it returns more than max_rows rows.

Source

fn columns( &self, sql: &str, profile: Option<&str>, ) -> Result<Vec<Column>, String>

The columns sql returns, without fetching rows.

Provided Methods§

Source

fn load( &self, _name: &str, _table: &Table, ) -> Result<Option<(String, Option<String>)>, String>

Load a lookup into a temp table on the renderer’s own session: Some((relation, plugin warning)), or None when the source can’t load rows.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§