Trait msql_srv::MysqlShim
[−]
[src]
pub trait MysqlShim<W: Write> { fn param_info(&self, stmt: u32) -> &[Column]; fn on_prepare(
&mut self,
query: &str,
info: StatementMetaWriter<W>
) -> Result<()>; fn on_execute(
&mut self,
id: u32,
params: Vec<Value>,
results: QueryResultWriter<W>
) -> Result<()>; fn on_close(&mut self, stmt: u32); fn on_query(
&mut self,
query: &str,
results: QueryResultWriter<W>
) -> Result<()>; }
Implementors of this trait can be used to drive a MySQL-compatible database backend.
Required Methods
fn param_info(&self, stmt: u32) -> &[Column]
Retrieve information about the parameters associated with a previously prepared statement.
This is needed to correctly parse the parameters provided by the client when executing a prepared statement.
fn on_prepare(
&mut self,
query: &str,
info: StatementMetaWriter<W>
) -> Result<()>
&mut self,
query: &str,
info: StatementMetaWriter<W>
) -> Result<()>
Called when the client issues a request to prepare query
for later execution.
The provided info
handle 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: Vec<Value>,
results: QueryResultWriter<W>
) -> Result<()>
&mut self,
id: u32,
params: Vec<Value>,
results: QueryResultWriter<W>
) -> Result<()>
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<()>
Called when the client issues a query for immediate execution.
Results should be returned using the given QueryResultWriter
.