1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
use super::*;
impl QueryBuilder for MysqlQueryBuilder {
fn prepare_returning(
&self,
_returning: &[SelectExpr],
_sql: &mut SqlWriter,
_collector: &mut dyn FnMut(Value),
) {
}
fn prepare_order_expr(
&self,
order_expr: &OrderExpr,
sql: &mut SqlWriter,
collector: &mut dyn FnMut(Value),
) {
match order_expr.nulls {
None => (),
Some(NullOrdering::Last) => {
self.prepare_simple_expr(&order_expr.expr, sql, collector);
write!(sql, " IS NULL ASC, ").unwrap()
}
Some(NullOrdering::First) => {
self.prepare_simple_expr(&order_expr.expr, sql, collector);
write!(sql, " IS NULL DESC, ").unwrap()
}
}
if !matches!(order_expr.order, Order::Field(_)) {
self.prepare_simple_expr(&order_expr.expr, sql, collector);
}
write!(sql, " ").unwrap();
self.prepare_order(order_expr, sql, collector);
}
fn prepare_query_statement(
&self,
query: &SubQueryStatement,
sql: &mut SqlWriter,
collector: &mut dyn FnMut(Value),
) {
query.prepare_statement(self, sql, collector);
}
fn prepare_with_clause_recursive_options(
&self,
_: &WithClause,
_: &mut SqlWriter,
_: &mut dyn FnMut(Value),
) {
}
fn prepare_with_query_clause_materialization(
&self,
_: &CommonTableExpression,
_: &mut SqlWriter,
) {
}
fn prepare_on_conflict_target(
&self,
_: &Option<OnConflictTarget>,
_: &mut SqlWriter,
_: &mut dyn FnMut(Value),
) {
}
fn prepare_on_conflict_keywords(&self, sql: &mut SqlWriter, _: &mut dyn FnMut(Value)) {
write!(sql, " ON DUPLICATE KEY ").unwrap();
}
fn prepare_on_conflict_do_update_keywords(
&self,
sql: &mut SqlWriter,
_: &mut dyn FnMut(Value),
) {
write!(sql, " UPDATE ").unwrap();
}
fn prepare_on_conflict_excluded_table(
&self,
col: &DynIden,
sql: &mut SqlWriter,
_: &mut dyn FnMut(Value),
) {
write!(sql, "VALUES(").unwrap();
col.prepare(sql, self.quote());
write!(sql, ")").unwrap();
}
fn insert_default_keyword(&self) -> &str {
"()"
}
}