1use super::query_builder::MysqlQueryBuilder;
4use super::MysqlValue;
5use crate::backend::sql_dialect::on_conflict_clause::SupportsOnConflictClause;
6use crate::backend::*;
7use crate::internal::derives::multiconnection::sql_dialect;
8use crate::query_builder::bind_collector::RawBytesBindCollector;
9use crate::sql_types::TypeMetadata;
10
11#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Default)]
13pub struct Mysql;
14
15#[allow(missing_debug_implementations)]
16#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
19#[non_exhaustive]
20pub enum MysqlType {
21 Tiny,
23 UnsignedTiny,
25 Short,
27 UnsignedShort,
29 Long,
31 UnsignedLong,
33 LongLong,
35 UnsignedLongLong,
37 Float,
39 Double,
41 Numeric,
43 Time,
45 Date,
47 DateTime,
50 Timestamp,
53 String,
55 Blob,
57 Bit,
59 Set,
61 Enum,
63}
64
65impl Backend for Mysql {
66 type QueryBuilder = MysqlQueryBuilder;
67 type RawValue<'a> = MysqlValue<'a>;
68 type BindCollector<'a> = RawBytesBindCollector<Self>;
69}
70
71impl TypeMetadata for Mysql {
72 type TypeMetadata = MysqlType;
73 type MetadataLookup = ();
74}
75
76impl SqlDialect for Mysql {
77 type ReturningClause = sql_dialect::returning_clause::DoesNotSupportReturningClause;
78
79 type OnConflictClause = MysqlOnConflictClause;
80
81 type InsertWithDefaultKeyword = sql_dialect::default_keyword_for_insert::IsoSqlDefaultKeyword;
82 type BatchInsertSupport = sql_dialect::batch_insert_support::PostgresLikeBatchInsertSupport;
83 type DefaultValueClauseForInsert = MysqlStyleDefaultValueClause;
84
85 type EmptyFromClauseSyntax = sql_dialect::from_clause_syntax::AnsiSqlFromClauseSyntax;
86 type SelectStatementSyntax = sql_dialect::select_statement_syntax::AnsiSqlSelectStatement;
87
88 type ExistsSyntax = sql_dialect::exists_syntax::AnsiSqlExistsSyntax;
89 type ArrayComparison = sql_dialect::array_comparison::AnsiSqlArrayComparison;
90
91 type ConcatClause = MysqlConcatClause;
92 type AliasSyntax = sql_dialect::alias_syntax::AsAliasSyntax;
93
94 type WindowFrameClauseGroupSupport =
95 sql_dialect::window_frame_clause_group_support::NoGroupWindowFrameUnit;
96
97 type WindowFrameExclusionSupport =
98 sql_dialect::window_frame_exclusion_support::NoFrameFrameExclusionSupport;
99
100 type AggregateFunctionExpressions =
101 sql_dialect::aggregate_function_expressions::NoAggregateFunctionExpressions;
102
103 type BuiltInWindowFunctionRequireOrder = MysqlRequiresOrderForWindowFunctions;
104}
105
106impl DieselReserveSpecialization for Mysql {}
107impl TrustedBackend for Mysql {}
108
109#[derive(Debug, Clone, Copy)]
110pub struct MysqlStyleDefaultValueClause;
111
112#[derive(Debug, Clone, Copy)]
113pub struct MysqlConcatClause;
114
115#[derive(Debug, Clone, Copy)]
116pub struct MysqlOnConflictClause;
117
118#[derive(Debug, Clone, Copy)]
119pub struct MysqlRequiresOrderForWindowFunctions;
120
121impl SupportsOnConflictClause for MysqlOnConflictClause {}