1//! The MySQL backend
23use super::query_builder::MysqlQueryBuilder;
4use super::MysqlValue;
5use crate::backend::sql_dialect::on_conflict_clause::SupportsOnConflictClause;
6use crate::backend::*;
7use crate::query_builder::bind_collector::RawBytesBindCollector;
8use crate::sql_types::TypeMetadata;
910/// The MySQL backend
11#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Default)]
12pub struct Mysql;
1314#[allow(missing_debug_implementations)]
15/// Represents possible types, that can be transmitted as via the
16/// Mysql wire protocol
17#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
18#[non_exhaustive]
19pub enum MysqlType {
20/// A 8 bit signed integer
21Tiny,
22/// A 8 bit unsigned integer
23UnsignedTiny,
24/// A 16 bit signed integer
25Short,
26/// A 16 bit unsigned integer
27UnsignedShort,
28/// A 32 bit signed integer
29Long,
30/// A 32 bit unsigned integer
31UnsignedLong,
32/// A 64 bit signed integer
33LongLong,
34/// A 64 bit unsigned integer
35UnsignedLongLong,
36/// A 32 bit floating point number
37Float,
38/// A 64 bit floating point number
39Double,
40/// A fixed point decimal value
41Numeric,
42/// A datatype to store a time value
43Time,
44/// A datatype to store a date value
45Date,
46/// A datatype containing timestamp values ranging from
47 /// '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.
48DateTime,
49/// A datatype containing timestamp values ranging from
50 /// 1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
51Timestamp,
52/// A datatype for string values
53String,
54/// A datatype containing binary large objects
55Blob,
56/// A value containing a set of bit's
57Bit,
58/// A user defined set type
59Set,
60/// A user defined enum type
61Enum,
62}
6364impl Backend for Mysql {
65type QueryBuilder = MysqlQueryBuilder;
66type RawValue<'a> = MysqlValue<'a>;
67type BindCollector<'a> = RawBytesBindCollector<Self>;
68}
6970impl TypeMetadata for Mysql {
71type TypeMetadata = MysqlType;
72type MetadataLookup = ();
73}
7475impl SqlDialect for Mysql {
76type ReturningClause = sql_dialect::returning_clause::DoesNotSupportReturningClause;
7778type OnConflictClause = MysqlOnConflictClause;
7980type InsertWithDefaultKeyword = sql_dialect::default_keyword_for_insert::IsoSqlDefaultKeyword;
81type BatchInsertSupport = sql_dialect::batch_insert_support::PostgresLikeBatchInsertSupport;
82type DefaultValueClauseForInsert = MysqlStyleDefaultValueClause;
8384type EmptyFromClauseSyntax = sql_dialect::from_clause_syntax::AnsiSqlFromClauseSyntax;
85type SelectStatementSyntax = sql_dialect::select_statement_syntax::AnsiSqlSelectStatement;
8687type ExistsSyntax = sql_dialect::exists_syntax::AnsiSqlExistsSyntax;
88type ArrayComparison = sql_dialect::array_comparison::AnsiSqlArrayComparison;
8990type ConcatClause = MysqlConcatClause;
91type AliasSyntax = sql_dialect::alias_syntax::AsAliasSyntax;
92}
9394impl DieselReserveSpecialization for Mysql {}
95impl TrustedBackend for Mysql {}
9697#[derive(Debug, Clone, Copy)]
98pub struct MysqlStyleDefaultValueClause;
99100#[derive(Debug, Clone, Copy)]
101pub struct MysqlConcatClause;
102103#[derive(Debug, Clone, Copy)]
104pub struct MysqlOnConflictClause;
105106impl SupportsOnConflictClause for MysqlOnConflictClause {}