[][src]Trait msql_srv::MysqlShim

pub trait MysqlShim<W: Write> {
    type Error: From<Error>;
    fn on_prepare(
        &mut self,
        query: &str,
        info: StatementMetaWriter<W>
    ) -> Result<(), Self::Error>;
fn on_execute(
        &mut self,
        id: u32,
        params: ParamParser,
        results: QueryResultWriter<W>
    ) -> Result<(), Self::Error>;
fn on_close(&mut self, stmt: u32);
fn on_query(
        &mut self,
        query: &str,
        results: QueryResultWriter<W>
    ) -> Result<(), Self::Error>; fn on_init(&mut self, _: &str, _: InitWriter<W>) -> Result<(), Self::Error> { ... } }

Implementors of this trait can be used to drive a MySQL-compatible database backend.

Associated Types

type Error: From<Error>

The error type produced by operations on this shim.

Must implement From<io::Error> so that transport-level errors can be lifted.

Loading content...

Required methods

fn on_prepare(
    &mut self,
    query: &str,
    info: StatementMetaWriter<W>
) -> Result<(), Self::Error>

Called when the client issues a request to prepare query for later execution.

The provided StatementMetaWriter should be used to notify the client of the statement id assigned to the prepared statement, as well as to give metadata about the types of parameters and returned columns.

fn on_execute(
    &mut self,
    id: u32,
    params: ParamParser,
    results: QueryResultWriter<W>
) -> Result<(), Self::Error>

Called when the client executes a previously prepared statement.

Any parameters included with the client's command is given in params. A response to the query should be given using the provided QueryResultWriter.

fn on_close(&mut self, stmt: u32)

Called when the client wishes to deallocate resources associated with a previously prepared statement.

fn on_query(
    &mut self,
    query: &str,
    results: QueryResultWriter<W>
) -> Result<(), Self::Error>

Called when the client issues a query for immediate execution.

Results should be returned using the given QueryResultWriter.

Loading content...

Provided methods

fn on_init(&mut self, _: &str, _: InitWriter<W>) -> Result<(), Self::Error>

Called when client switches database.

Loading content...

Implementors

Loading content...