Skip to main content

MysqlQueryBuilder

Struct MysqlQueryBuilder 

Source
pub struct MysqlQueryBuilder;
Expand description

Mysql query builder.

Trait Implementations§

Source§

impl Debug for MysqlQueryBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MysqlQueryBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl EscapeBuilder for MysqlQueryBuilder

Source§

fn needs_escape(&self, s: &str) -> bool

Return if string literal needs to be escaped
Source§

fn escape_string(&self, string: &str) -> String

Escape a SQL string literal
Source§

fn write_escaped(&self, buffer: &mut impl Write, string: &str)

Source§

impl OperLeftAssocDecider for MysqlQueryBuilder

Source§

impl PrecedenceDecider for MysqlQueryBuilder

Source§

fn inner_expr_well_known_greater_precedence( &self, inner: &Expr, outer_oper: &Oper, ) -> bool

Source§

impl QueryBuilder for MysqlQueryBuilder

Source§

fn lexer_dialect(&self) -> Dialect

Whose lexical rules SQL text written for this builder follows: where its strings, comments and markers begin and end.
Source§

fn values_list_tuple_prefix(&self) -> &str

Prefix for tuples in VALUES list (e.g. ROW for MySQL)
Source§

fn prepare_select_distinct( &self, select_distinct: &SelectDistinct, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate SelectDistinct into SQL statement.
Source§

fn prepare_select_lock( &self, lock: &LockClause, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate LockType into SQL statement.
Source§

fn prepare_select_into( &self, _: &SelectInto, _: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn prepare_with_query_clause_materialization( &self, _: &CommonTableExpression, _: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn prepare_update_join( &self, from: &[TableRef], condition: &ConditionHolder, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn prepare_update_from( &self, _: &[TableRef], _: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn prepare_update_column( &self, table: &Option<Box<TableRef>>, from: &[TableRef], column: &DynIden, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn prepare_update_condition( &self, from: &[TableRef], condition: &ConditionHolder, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn prepare_join_type( &self, join_type: &JoinType, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate JoinType into SQL statement.
Source§

fn prepare_order_expr( &self, order_expr: &OrderExpr, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate OrderExpr into SQL statement.
Source§

fn prepare_select_limit_offset( &self, select: &SelectStatement, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn insert_default_keyword(&self) -> &str

The keywords for insert default row.
Source§

fn placeholder(&self) -> (&'static str, bool)

The type of placeholder the builder uses for values, and whether it is numbered.
Source§

fn prepare_union_statement( &self, union_type: UnionType, select_statement: &SelectStatement, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn prepare_expr( &self, simple_expr: &Expr, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate Expr into SQL statement.
Source§

fn prepare_bin_oper( &self, bin_oper: &BinOper, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate BinOper into SQL statement.
Source§

fn prepare_sub_query_oper( &self, oper: &SubQueryOper, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate SubQueryOper into SQL statement.
Source§

fn prepare_query_statement( &self, query: &SubQueryStatement, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate QueryStatement into SQL statement.
Source§

fn prepare_function_name( &self, function: &Func, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Source§

fn prepare_value( &self, value: Value, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Write Value into SQL statement as parameter.
Source§

fn write_string_quoted(&self, string: &str, buffer: &mut impl Write)

Source§

fn insert_default_values( &self, num_rows: usize, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Write insert default rows expression.
Source§

impl QuotedBuilder for MysqlQueryBuilder

Source§

fn quote(&self) -> Quote

The type of quote the builder uses.
Source§

fn prepare_iden(&self, iden: &DynIden, sql: &mut impl SqlWriter)

To prepare iden and write to SQL.
Source§

impl SqlDialect for MysqlQueryBuilder

Source§

fn limit_in_subquery(&self) -> bool

MySQL and MariaDB take a LIMIT in an IN subquery only a derived table further down.

Source§

fn identifier_quote(&self) -> Quote

The quotes around an identifier.
Source§

fn marker(&self, index: usize) -> String

The marker of the index-th (1-based) bound value.
Source§

fn numbered_markers(&self) -> bool

Whether markers are numbered ($1). Read more
Source§

fn expression( &self, sql: String, values: Vec<Value>, ) -> Result<Expr, RenderError>

SQL written with this dialect’s markers, such as a raw fragment, as an expression binding values to its markers in order. The dialect’s own pieces need no reading: a BoundSql is an expression as it is. Read more
Source§

fn inline_values( &self, sql: &str, values: &[Value], ) -> Result<String, RenderError>

sql with values written in place of its markers, for display.
Source§

fn string_literal(&self, text: &str) -> String

text as a quoted string literal, escaped as inline_values writes one, for SQL that cannot bind it: DDL, or a constant an index expression must match.
Source§

fn json_equals(&self, column: &str, value: &Value, negated: bool) -> BoundSql

column holds the JSON document value, or does not when negated. Read more
Source§

fn json_containment( &self, column: &str, value: &Value, containment: JsonContainment, ) -> BoundSql

A JSON containment test of column against value.
Source§

fn json_exists( &self, column: &str, existence: JsonExistence, target: &str, negated: bool, ) -> Result<BoundSql, RenderError>

A JSON key- or path-existence test, or its negation. Read more
Source§

fn array_predicate( &self, column: &str, operator: ArrayOperator, elements: Vec<Value>, _null_allowed: bool, ) -> BoundSql

An array predicate on column against the list elements. Read more
Source§

fn array_append(&self, column: &str, element: Value) -> BoundSql

column with element appended; a NULL column starts a new array.
Source§

fn array_remove(&self, column: &str, _source: &str, element: Value) -> BoundSql

column without the elements equal to element. Read more
Source§

fn json_set( &self, column: &str, path: &[JsonPathStep], value: &Value, ) -> BoundSql

column with the member or element at path set to value. Read more
Source§

fn window_default( &self, function: &str, column: &str, offset: &str, default: &str, over: &str, ) -> String

LAG or LEAD (function) with a default, over the window over.
Source§

fn open_limit(&self) -> Option<&'static str>

The limit an offset alone takes, where the dialect has no bare OFFSET.
Source§

fn groups_frames(&self) -> bool

Whether a window frame may count GROUPS.
Source§

fn update_limit(&self) -> bool

Whether an UPDATE takes ORDER BY and LIMIT itself. Where it does not, a capped update is scoped through a primary-key subquery; the builder renders an UpdateStatement’s limit as it is told.
Source§

fn exact_key(&self, column: &str) -> String

column as a value that compares byte for byte, whatever its collation, so two spellings a case- or accent-insensitive collation matches stay apart.
Source§

fn push_identifier(&self, out: &mut String, name: &str)

Append name to out as a quoted identifier, doubling any quote inside it.
Source§

fn native_arrays(&self) -> bool

Whether an array column is the database’s own array type. Read more
Source§

fn limit_offset(&self, limit: Option<u64>, offset: Option<u64>) -> BoundSql

A query’s LIMIT n OFFSET ?. Read more
Source§

fn literal_match( &self, column: &str, literal: &str, leading: bool, trailing: bool, ) -> Result<BoundSql, RenderError>

A test that column holds the text literal, preceded by anything when leading and followed by anything when trailing: a LIKE pattern with the literal’s %, _ and escape character escaped. Refused when the backend cannot test literal as it is.
Source§

fn in_list(&self, column: Expr, values: Vec<Value>, negated: bool) -> Expr

column IN values, or NOT IN when negated. A long all-integer list is written as literals.
Source§

impl TableRefBuilder for MysqlQueryBuilder

Source§

fn prepare_table_ref_iden( &self, table_ref: &TableRef, sql: &mut impl SqlWriter, ) -> Result<(), RenderError>

Translate TableRef that without values into SQL statement.
Source§

fn prepare_table_name(&self, table_name: &TableName, sql: &mut impl SqlWriter)

Translate TableName into an SQL statement.
Source§

fn prepare_schema_name( &self, schema_name: &SchemaName, sql: &mut impl SqlWriter, )

Translate SchemaName into an SQL statement.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.