diesel/mysql/
backend.rs

1//! The MySQL backend
2
3use 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/// The MySQL backend
12#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Mysql {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "Mysql")
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for Mysql { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Mysql {
    #[inline]
    fn clone(&self) -> Mysql { *self }
}Clone, #[automatically_derived]
impl ::core::hash::Hash for Mysql {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {}
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for Mysql {
    #[inline]
    fn eq(&self, other: &Mysql) -> bool { true }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Mysql {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::default::Default for Mysql {
    #[inline]
    fn default() -> Mysql { Mysql {} }
}Default)]
13pub struct Mysql;
14
15#[allow(missing_debug_implementations)]
16/// Represents possible types, that can be transmitted as via the
17/// Mysql wire protocol
18#[derive(#[automatically_derived]
#[allow(missing_debug_implementations)]
impl ::core::fmt::Debug for MysqlType {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                MysqlType::Tiny => "Tiny",
                MysqlType::UnsignedTiny => "UnsignedTiny",
                MysqlType::Short => "Short",
                MysqlType::UnsignedShort => "UnsignedShort",
                MysqlType::Long => "Long",
                MysqlType::UnsignedLong => "UnsignedLong",
                MysqlType::LongLong => "LongLong",
                MysqlType::UnsignedLongLong => "UnsignedLongLong",
                MysqlType::Float => "Float",
                MysqlType::Double => "Double",
                MysqlType::Numeric => "Numeric",
                MysqlType::Time => "Time",
                MysqlType::Date => "Date",
                MysqlType::DateTime => "DateTime",
                MysqlType::Timestamp => "Timestamp",
                MysqlType::String => "String",
                MysqlType::Blob => "Blob",
                MysqlType::Bit => "Bit",
                MysqlType::Set => "Set",
                MysqlType::Enum => "Enum",
            })
    }
}Debug, #[automatically_derived]
#[allow(missing_debug_implementations)]
impl ::core::hash::Hash for MysqlType {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
#[allow(missing_debug_implementations)]
impl ::core::cmp::PartialEq for MysqlType {
    #[inline]
    fn eq(&self, other: &MysqlType) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
#[allow(missing_debug_implementations)]
impl ::core::cmp::Eq for MysqlType {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
#[allow(missing_debug_implementations)]
impl ::core::clone::Clone for MysqlType {
    #[inline]
    fn clone(&self) -> MysqlType { *self }
}Clone, #[automatically_derived]
#[allow(missing_debug_implementations)]
impl ::core::marker::Copy for MysqlType { }Copy)]
19#[non_exhaustive]
20pub enum MysqlType {
21    /// A 8 bit signed integer
22    Tiny,
23    /// A 8 bit unsigned integer
24    UnsignedTiny,
25    /// A 16 bit signed integer
26    Short,
27    /// A 16 bit unsigned integer
28    UnsignedShort,
29    /// A 32 bit signed integer
30    Long,
31    /// A 32 bit unsigned integer
32    UnsignedLong,
33    /// A 64 bit signed integer
34    LongLong,
35    /// A 64 bit unsigned integer
36    UnsignedLongLong,
37    /// A 32 bit floating point number
38    Float,
39    /// A 64 bit floating point number
40    Double,
41    /// A fixed point decimal value
42    Numeric,
43    /// A datatype to store a time value
44    Time,
45    /// A datatype to store a date value
46    Date,
47    /// A datatype containing timestamp values ranging from
48    /// '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.
49    DateTime,
50    /// A datatype containing timestamp values ranging from
51    /// 1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
52    Timestamp,
53    /// A datatype for string values
54    String,
55    /// A datatype containing binary large objects
56    Blob,
57    /// A value containing a set of bit's
58    Bit,
59    /// A user defined set type
60    Set,
61    /// A user defined enum type
62    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(#[automatically_derived]
impl ::core::fmt::Debug for MysqlStyleDefaultValueClause {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "MysqlStyleDefaultValueClause")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for MysqlStyleDefaultValueClause {
    #[inline]
    fn clone(&self) -> MysqlStyleDefaultValueClause { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlStyleDefaultValueClause { }Copy)]
110pub struct MysqlStyleDefaultValueClause;
111
112#[derive(#[automatically_derived]
impl ::core::fmt::Debug for MysqlConcatClause {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "MysqlConcatClause")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for MysqlConcatClause {
    #[inline]
    fn clone(&self) -> MysqlConcatClause { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlConcatClause { }Copy)]
113pub struct MysqlConcatClause;
114
115#[derive(#[automatically_derived]
impl ::core::fmt::Debug for MysqlOnConflictClause {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "MysqlOnConflictClause")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for MysqlOnConflictClause {
    #[inline]
    fn clone(&self) -> MysqlOnConflictClause { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlOnConflictClause { }Copy)]
116pub struct MysqlOnConflictClause;
117
118#[derive(#[automatically_derived]
impl ::core::fmt::Debug for MysqlRequiresOrderForWindowFunctions {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            "MysqlRequiresOrderForWindowFunctions")
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for MysqlRequiresOrderForWindowFunctions {
    #[inline]
    fn clone(&self) -> MysqlRequiresOrderForWindowFunctions { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlRequiresOrderForWindowFunctions { }Copy)]
119pub struct MysqlRequiresOrderForWindowFunctions;
120
121impl SupportsOnConflictClause for MysqlOnConflictClause {}