pub trait QueryBuilder:
QuotedBuilder
+ EscapeBuilder
+ TableRefBuilder
+ OperLeftAssocDecider
+ PrecedenceDecider {
Show 58 methods
// Required methods
fn prepare_query_statement(
&self,
query: &SubQueryStatement,
sql: &mut dyn SqlWriter,
);
fn prepare_value(&self, value: &Value, sql: &mut dyn SqlWriter);
// Provided methods
fn placeholder(&self) -> (&str, bool) { ... }
fn values_list_tuple_prefix(&self) -> &str { ... }
fn prepare_insert_statement(
&self,
insert: &InsertStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_union_statement(
&self,
union_type: UnionType,
select_statement: &SelectStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_select_statement(
&self,
select: &SelectStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_select_limit_offset(
&self,
select: &SelectStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_update_statement(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_update_order_by(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_update_limit(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_delete_statement(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_delete_order_by(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_delete_limit(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_simple_expr(
&self,
simple_expr: &SimpleExpr,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_simple_expr_common(
&self,
simple_expr: &SimpleExpr,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_case_statement(
&self,
stmts: &CaseStatement,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_select_distinct(
&self,
select_distinct: &SelectDistinct,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_index_hints(
&self,
_select: &SelectStatement,
_sql: &mut dyn SqlWriter,
) { ... }
fn prepare_select_lock(&self, lock: &LockClause, sql: &mut dyn SqlWriter) { ... }
fn prepare_select_expr(
&self,
select_expr: &SelectExpr,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_join_expr(&self, join_expr: &JoinExpr, sql: &mut dyn SqlWriter) { ... }
fn prepare_join_table_ref(
&self,
join_expr: &JoinExpr,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_table_ref(&self, table_ref: &TableRef, sql: &mut dyn SqlWriter) { ... }
fn prepare_column_ref(
&self,
column_ref: &ColumnRef,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_un_oper(&self, un_oper: &UnOper, sql: &mut dyn SqlWriter) { ... }
fn prepare_bin_oper_common(
&self,
bin_oper: &BinOper,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_bin_oper(&self, bin_oper: &BinOper, sql: &mut dyn SqlWriter) { ... }
fn prepare_sub_query_oper(
&self,
oper: &SubQueryOper,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_logical_chain_oper(
&self,
log_chain_oper: &LogicalChainOper,
i: usize,
length: usize,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_function_name_common(
&self,
function: &Function,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_function_arguments(
&self,
func: &FunctionCall,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_with_query(&self, query: &WithQuery, sql: &mut dyn SqlWriter) { ... }
fn prepare_with_clause(
&self,
with_clause: &WithClause,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_with_clause_recursive_options(
&self,
with_clause: &WithClause,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_with_clause_common_tables(
&self,
with_clause: &WithClause,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_with_query_clause_common_table(
&self,
cte: &CommonTableExpression,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_with_query_clause_materialization(
&self,
cte: &CommonTableExpression,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_with_clause_start(
&self,
with_clause: &WithClause,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_insert(&self, replace: bool, sql: &mut dyn SqlWriter) { ... }
fn prepare_function_name(
&self,
function: &Function,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_join_type(&self, join_type: &JoinType, sql: &mut dyn SqlWriter) { ... }
fn prepare_join_type_common(
&self,
join_type: &JoinType,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_order_expr(
&self,
order_expr: &OrderExpr,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_join_on(&self, join_on: &JoinOn, sql: &mut dyn SqlWriter) { ... }
fn prepare_order(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter) { ... }
fn prepare_field_order(
&self,
order_expr: &OrderExpr,
values: &Values,
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_constant(&self, value: &Value, sql: &mut dyn SqlWriter) { ... }
fn prepare_values_list(
&self,
value_tuples: &[ValueTuple],
sql: &mut dyn SqlWriter,
) { ... }
fn prepare_tuple(&self, exprs: &[SimpleExpr], sql: &mut dyn SqlWriter) { ... }
fn prepare_keyword(&self, keyword: &Keyword, sql: &mut dyn SqlWriter) { ... }
fn value_to_string(&self, v: &Value) -> String { ... }
fn value_to_string_common(&self, v: &Value) -> String { ... }
fn prepare_on_conflict_action_common(
&self,
on_conflict_action: &Option<OnConflictAction>,
sql: &mut dyn SqlWriter,
) { ... }
fn insert_default_keyword(&self) -> &str { ... }
fn insert_default_values(&self, num_rows: u32, sql: &mut dyn SqlWriter) { ... }
fn prepare_constant_true(&self, sql: &mut dyn SqlWriter) { ... }
fn prepare_constant_false(&self, sql: &mut dyn SqlWriter) { ... }
}
Required Methods§
sourcefn prepare_query_statement(
&self,
query: &SubQueryStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_query_statement( &self, query: &SubQueryStatement, sql: &mut dyn SqlWriter, )
Translate QueryStatement
into SQL statement.
sourcefn prepare_value(&self, value: &Value, sql: &mut dyn SqlWriter)
fn prepare_value(&self, value: &Value, sql: &mut dyn SqlWriter)
Write Value
into SQL statement as parameter.
Provided Methods§
sourcefn placeholder(&self) -> (&str, bool)
fn placeholder(&self) -> (&str, bool)
The type of placeholder the builder uses for values, and whether it is numbered.
sourcefn values_list_tuple_prefix(&self) -> &str
fn values_list_tuple_prefix(&self) -> &str
Prefix for tuples in VALUES list (e.g. ROW for Mysql)
sourcefn prepare_insert_statement(
&self,
insert: &InsertStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_insert_statement( &self, insert: &InsertStatement, sql: &mut dyn SqlWriter, )
Translate InsertStatement
into SQL statement.
fn prepare_union_statement( &self, union_type: UnionType, select_statement: &SelectStatement, sql: &mut dyn SqlWriter, )
sourcefn prepare_select_statement(
&self,
select: &SelectStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_select_statement( &self, select: &SelectStatement, sql: &mut dyn SqlWriter, )
Translate SelectStatement
into SQL statement.
fn prepare_select_limit_offset( &self, select: &SelectStatement, sql: &mut dyn SqlWriter, )
sourcefn prepare_update_statement(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_update_statement( &self, update: &UpdateStatement, sql: &mut dyn SqlWriter, )
Translate UpdateStatement
into SQL statement.
sourcefn prepare_update_order_by(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_update_order_by( &self, update: &UpdateStatement, sql: &mut dyn SqlWriter, )
Translate ORDER BY expression in UpdateStatement
.
sourcefn prepare_update_limit(
&self,
update: &UpdateStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_update_limit( &self, update: &UpdateStatement, sql: &mut dyn SqlWriter, )
Translate LIMIT expression in UpdateStatement
.
sourcefn prepare_delete_statement(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_delete_statement( &self, delete: &DeleteStatement, sql: &mut dyn SqlWriter, )
Translate DeleteStatement
into SQL statement.
sourcefn prepare_delete_order_by(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_delete_order_by( &self, delete: &DeleteStatement, sql: &mut dyn SqlWriter, )
Translate ORDER BY expression in DeleteStatement
.
sourcefn prepare_delete_limit(
&self,
delete: &DeleteStatement,
sql: &mut dyn SqlWriter,
)
fn prepare_delete_limit( &self, delete: &DeleteStatement, sql: &mut dyn SqlWriter, )
Translate LIMIT expression in DeleteStatement
.
sourcefn prepare_simple_expr(&self, simple_expr: &SimpleExpr, sql: &mut dyn SqlWriter)
fn prepare_simple_expr(&self, simple_expr: &SimpleExpr, sql: &mut dyn SqlWriter)
Translate SimpleExpr
into SQL statement.
fn prepare_simple_expr_common( &self, simple_expr: &SimpleExpr, sql: &mut dyn SqlWriter, )
sourcefn prepare_case_statement(&self, stmts: &CaseStatement, sql: &mut dyn SqlWriter)
fn prepare_case_statement(&self, stmts: &CaseStatement, sql: &mut dyn SqlWriter)
Translate CaseStatement
into SQL statement.
sourcefn prepare_select_distinct(
&self,
select_distinct: &SelectDistinct,
sql: &mut dyn SqlWriter,
)
fn prepare_select_distinct( &self, select_distinct: &SelectDistinct, sql: &mut dyn SqlWriter, )
Translate SelectDistinct
into SQL statement.
sourcefn prepare_index_hints(
&self,
_select: &SelectStatement,
_sql: &mut dyn SqlWriter,
)
fn prepare_index_hints( &self, _select: &SelectStatement, _sql: &mut dyn SqlWriter, )
Translate [IndexHint
] into SQL statement.
sourcefn prepare_select_lock(&self, lock: &LockClause, sql: &mut dyn SqlWriter)
fn prepare_select_lock(&self, lock: &LockClause, sql: &mut dyn SqlWriter)
Translate LockType
into SQL statement.
sourcefn prepare_select_expr(&self, select_expr: &SelectExpr, sql: &mut dyn SqlWriter)
fn prepare_select_expr(&self, select_expr: &SelectExpr, sql: &mut dyn SqlWriter)
Translate SelectExpr
into SQL statement.
sourcefn prepare_join_expr(&self, join_expr: &JoinExpr, sql: &mut dyn SqlWriter)
fn prepare_join_expr(&self, join_expr: &JoinExpr, sql: &mut dyn SqlWriter)
Translate JoinExpr
into SQL statement.
fn prepare_join_table_ref(&self, join_expr: &JoinExpr, sql: &mut dyn SqlWriter)
sourcefn prepare_table_ref(&self, table_ref: &TableRef, sql: &mut dyn SqlWriter)
fn prepare_table_ref(&self, table_ref: &TableRef, sql: &mut dyn SqlWriter)
Translate TableRef
into SQL statement.
fn prepare_column_ref(&self, column_ref: &ColumnRef, sql: &mut dyn SqlWriter)
sourcefn prepare_un_oper(&self, un_oper: &UnOper, sql: &mut dyn SqlWriter)
fn prepare_un_oper(&self, un_oper: &UnOper, sql: &mut dyn SqlWriter)
Translate UnOper
into SQL statement.
fn prepare_bin_oper_common(&self, bin_oper: &BinOper, sql: &mut dyn SqlWriter)
sourcefn prepare_bin_oper(&self, bin_oper: &BinOper, sql: &mut dyn SqlWriter)
fn prepare_bin_oper(&self, bin_oper: &BinOper, sql: &mut dyn SqlWriter)
Translate BinOper
into SQL statement.
sourcefn prepare_sub_query_oper(&self, oper: &SubQueryOper, sql: &mut dyn SqlWriter)
fn prepare_sub_query_oper(&self, oper: &SubQueryOper, sql: &mut dyn SqlWriter)
Translate SubQueryOper
into SQL statement.
sourcefn prepare_logical_chain_oper(
&self,
log_chain_oper: &LogicalChainOper,
i: usize,
length: usize,
sql: &mut dyn SqlWriter,
)
fn prepare_logical_chain_oper( &self, log_chain_oper: &LogicalChainOper, i: usize, length: usize, sql: &mut dyn SqlWriter, )
Translate LogicalChainOper
into SQL statement.
sourcefn prepare_function_name_common(
&self,
function: &Function,
sql: &mut dyn SqlWriter,
)
fn prepare_function_name_common( &self, function: &Function, sql: &mut dyn SqlWriter, )
Translate Function
into SQL statement.
fn prepare_function_arguments( &self, func: &FunctionCall, sql: &mut dyn SqlWriter, )
fn prepare_with_query(&self, query: &WithQuery, sql: &mut dyn SqlWriter)
fn prepare_with_clause(&self, with_clause: &WithClause, sql: &mut dyn SqlWriter)
fn prepare_with_clause_recursive_options( &self, with_clause: &WithClause, sql: &mut dyn SqlWriter, )
fn prepare_with_clause_common_tables( &self, with_clause: &WithClause, sql: &mut dyn SqlWriter, )
fn prepare_with_query_clause_common_table( &self, cte: &CommonTableExpression, sql: &mut dyn SqlWriter, )
fn prepare_with_query_clause_materialization( &self, cte: &CommonTableExpression, sql: &mut dyn SqlWriter, )
fn prepare_with_clause_start( &self, with_clause: &WithClause, sql: &mut dyn SqlWriter, )
fn prepare_insert(&self, replace: bool, sql: &mut dyn SqlWriter)
fn prepare_function_name(&self, function: &Function, sql: &mut dyn SqlWriter)
sourcefn prepare_join_type(&self, join_type: &JoinType, sql: &mut dyn SqlWriter)
fn prepare_join_type(&self, join_type: &JoinType, sql: &mut dyn SqlWriter)
Translate JoinType
into SQL statement.
fn prepare_join_type_common( &self, join_type: &JoinType, sql: &mut dyn SqlWriter, )
sourcefn prepare_order_expr(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter)
fn prepare_order_expr(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter)
Translate OrderExpr
into SQL statement.
sourcefn prepare_join_on(&self, join_on: &JoinOn, sql: &mut dyn SqlWriter)
fn prepare_join_on(&self, join_on: &JoinOn, sql: &mut dyn SqlWriter)
Translate JoinOn
into SQL statement.
sourcefn prepare_order(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter)
fn prepare_order(&self, order_expr: &OrderExpr, sql: &mut dyn SqlWriter)
Translate Order
into SQL statement.
sourcefn prepare_field_order(
&self,
order_expr: &OrderExpr,
values: &Values,
sql: &mut dyn SqlWriter,
)
fn prepare_field_order( &self, order_expr: &OrderExpr, values: &Values, sql: &mut dyn SqlWriter, )
Translate Order::Field
into SQL statement
sourcefn prepare_constant(&self, value: &Value, sql: &mut dyn SqlWriter)
fn prepare_constant(&self, value: &Value, sql: &mut dyn SqlWriter)
Write Value
inline.
sourcefn prepare_values_list(
&self,
value_tuples: &[ValueTuple],
sql: &mut dyn SqlWriter,
)
fn prepare_values_list( &self, value_tuples: &[ValueTuple], sql: &mut dyn SqlWriter, )
Translate a &[ValueTuple]
into a VALUES list.
sourcefn prepare_tuple(&self, exprs: &[SimpleExpr], sql: &mut dyn SqlWriter)
fn prepare_tuple(&self, exprs: &[SimpleExpr], sql: &mut dyn SqlWriter)
Translate SimpleExpr::Tuple
into SQL statement.
sourcefn prepare_keyword(&self, keyword: &Keyword, sql: &mut dyn SqlWriter)
fn prepare_keyword(&self, keyword: &Keyword, sql: &mut dyn SqlWriter)
Translate Keyword
into SQL statement.
sourcefn value_to_string(&self, v: &Value) -> String
fn value_to_string(&self, v: &Value) -> String
Convert a SQL value into syntax-specific string
fn value_to_string_common(&self, v: &Value) -> String
fn prepare_on_conflict_action_common( &self, on_conflict_action: &Option<OnConflictAction>, sql: &mut dyn SqlWriter, )
sourcefn insert_default_keyword(&self) -> &str
fn insert_default_keyword(&self) -> &str
The keywords for insert default row.
sourcefn insert_default_values(&self, num_rows: u32, sql: &mut dyn SqlWriter)
fn insert_default_values(&self, num_rows: u32, sql: &mut dyn SqlWriter)
Write insert default rows expression.
sourcefn prepare_constant_true(&self, sql: &mut dyn SqlWriter)
fn prepare_constant_true(&self, sql: &mut dyn SqlWriter)
Write TRUE constant
sourcefn prepare_constant_false(&self, sql: &mut dyn SqlWriter)
fn prepare_constant_false(&self, sql: &mut dyn SqlWriter)
Write FALSE constant
Implementors§
impl QueryBuilder for MysqlQueryBuilder
backend-mysql
only.impl QueryBuilder for PostgresQueryBuilder
backend-postgres
only.impl QueryBuilder for SqliteQueryBuilder
backend-sqlite
only.