pub struct Mysql<'a> { /* private fields */ }
Expand description
A visitor to generate queries for the MySQL database.
The returned parameter values can be used directly with the mysql crate.
Trait Implementations§
Source§impl<'a> Visitor<'a> for Mysql<'a>
impl<'a> Visitor<'a> for Mysql<'a>
Source§const C_BACKTICK: &'static str = "`"
const C_BACKTICK: &'static str = "`"
Backtick character to surround identifiers, such as column and table names.
Source§const C_WILDCARD: &'static str = "%"
const C_WILDCARD: &'static str = "%"
Wildcard character to be used in
LIKE
queries.Source§fn build<Q>(query: Q) -> (String, Vec<ParameterizedValue<'a>>)
fn build<Q>(query: Q) -> (String, Vec<ParameterizedValue<'a>>)
Convert the given
Query
to an SQL string and a vector of parameters.
When certain parameters are replaced with the C_PARAM
character in the
query, the vector should contain the parameter value in the right position. Read moreSource§fn visit_insert(&mut self, insert: Insert<'a>) -> Result
fn visit_insert(&mut self, insert: Insert<'a>) -> Result
A walk through an
INSERT
statementSource§fn parameter_substitution(&mut self) -> Result
fn parameter_substitution(&mut self) -> Result
What to use to substitute a parameter in the query.
Source§fn add_parameter(&mut self, value: ParameterizedValue<'a>)
fn add_parameter(&mut self, value: ParameterizedValue<'a>)
When called, the visitor decided to not render the parameter into the query,
replacing it with the
C_PARAM
, calling add_parameter
with the replaced value.Source§fn visit_limit_and_offset(
&mut self,
limit: Option<ParameterizedValue<'a>>,
offset: Option<ParameterizedValue<'a>>,
) -> Result
fn visit_limit_and_offset( &mut self, limit: Option<ParameterizedValue<'a>>, offset: Option<ParameterizedValue<'a>>, ) -> Result
The
LIMIT
and OFFSET
statement in the querySource§fn visit_aggregate_to_string(&mut self, value: DatabaseValue<'a>) -> Result
fn visit_aggregate_to_string(&mut self, value: DatabaseValue<'a>) -> Result
What to use to substitute a parameter in the query.
fn surround_with<F>(&mut self, begin: &str, end: &str, f: F) -> Result
Source§fn visit_parameterized(&mut self, value: ParameterizedValue<'a>) -> Result
fn visit_parameterized(&mut self, value: ParameterizedValue<'a>) -> Result
A visit to a value we parameterize
fn visit_join_data(&mut self, data: JoinData<'a>) -> Result
Source§fn visit_select(&mut self, select: Select<'a>) -> Result
fn visit_select(&mut self, select: Select<'a>) -> Result
A walk through a
SELECT
statementSource§fn visit_update(&mut self, update: Update<'a>) -> Result
fn visit_update(&mut self, update: Update<'a>) -> Result
A walk through an
UPDATE
statementSource§fn visit_delete(&mut self, delete: Delete<'a>) -> Result
fn visit_delete(&mut self, delete: Delete<'a>) -> Result
A walk through an
DELETE
statementSource§fn delimited_identifiers(&mut self, parts: &[&str]) -> Result
fn delimited_identifiers(&mut self, parts: &[&str]) -> Result
A helper for delimiting an identifier, surrounding every part with
C_BACKTICK
and delimiting the values with a .
Source§fn visit_query(&mut self, query: Query<'a>)
fn visit_query(&mut self, query: Query<'a>)
A walk through a complete
Query
statementSource§fn visit_union(&mut self, ua: Union<'a>) -> Result
fn visit_union(&mut self, ua: Union<'a>) -> Result
A walk through a union of
SELECT
statementsSource§fn visit_columns(&mut self, columns: Vec<DatabaseValue<'a>>) -> Result
fn visit_columns(&mut self, columns: Vec<DatabaseValue<'a>>) -> Result
The selected columns
fn visit_operation(&mut self, op: SqlOp<'a>) -> Result
Source§fn visit_database_value(&mut self, value: DatabaseValue<'a>) -> Result
fn visit_database_value(&mut self, value: DatabaseValue<'a>) -> Result
A visit to a value used in an expression
Source§fn visit_table(&mut self, table: Table<'a>, include_alias: bool) -> Result
fn visit_table(&mut self, table: Table<'a>, include_alias: bool) -> Result
A database table identifier
Source§fn visit_column(&mut self, column: Column<'a>) -> Result
fn visit_column(&mut self, column: Column<'a>) -> Result
A database column identifier
Source§fn visit_conditions(&mut self, tree: ConditionTree<'a>) -> Result
fn visit_conditions(&mut self, tree: ConditionTree<'a>) -> Result
A walk through the query conditions
Source§fn visit_expression(&mut self, expression: Expression<'a>) -> Result
fn visit_expression(&mut self, expression: Expression<'a>) -> Result
An expression that can either be a single value, a set of conditions or
a comparison call
Source§fn visit_compare(&mut self, compare: Compare<'a>) -> Result
fn visit_compare(&mut self, compare: Compare<'a>) -> Result
A comparison expression
Source§fn visit_ordering(&mut self, ordering: Ordering<'a>) -> Result
fn visit_ordering(&mut self, ordering: Ordering<'a>) -> Result
A visit in the
ORDER BY
section of the querySource§fn visit_grouping(&mut self, grouping: Grouping<'a>) -> Result
fn visit_grouping(&mut self, grouping: Grouping<'a>) -> Result
A visit in the
GROUP BY
section of the queryfn visit_function(&mut self, fun: Function<'a>) -> Result
fn visit_partitioning(&mut self, over: Over<'a>) -> Result
Auto Trait Implementations§
impl<'a> Freeze for Mysql<'a>
impl<'a> RefUnwindSafe for Mysql<'a>
impl<'a> Send for Mysql<'a>
impl<'a> Sync for Mysql<'a>
impl<'a> Unpin for Mysql<'a>
impl<'a> UnwindSafe for Mysql<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more