1#[cfg(any(feature = "mysql", feature = "mariadb"))]
4mod connection;
5mod types;
6
7pub(crate) mod query_builder;
8mod value;
9
10use core::hash::Hash;
11
12use crate::backend::{Backend, DieselReserveSpecialization};
13use crate::mysql_like::query_builder::MysqlLikeQueryBuilder;
14use crate::query_builder::bind_collector::RawBytesBindCollector;
15use crate::result::DatabaseErrorKind;
16use crate::sql_types::TypeMetadata;
17
18#[cfg(any(feature = "mysql", feature = "mariadb"))]
19pub use self::connection::MysqlLikeConnection;
20pub use self::value::{MysqlValue, NumericRepresentation};
21
22pub mod data_types {
27 #[doc(inline)]
28 pub use super::types::date_and_time::MysqlTime;
29 #[doc(inline)]
30 pub use super::types::date_and_time::MysqlTimestampType;
31}
32
33pub mod sql_types {
35 #[doc(inline)]
36 pub use super::types::Datetime;
37 #[doc(inline)]
38 pub use super::types::Unsigned;
39}
40
41#[cfg_attr(
44 not(feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"),
45 expect(private_bounds)
46)]
47pub trait MysqlLikeBackend
48where
49 Self: for<'a> Backend<
50 RawValue<'a> = MysqlValue<'a>,
51 BindCollector<'a> = RawBytesBindCollector<Self>,
52 >,
53 Self: TypeMetadata<TypeMetadata = MysqlType, MetadataLookup = ()>,
54 Self: Backend<QueryBuilder = MysqlLikeQueryBuilder<Self>>,
55 Self: Hash + Eq + Default,
56 Self: DieselReserveSpecialization,
57 Self: MapErrorNumber,
58 Self: 'static,
59{
60 #[doc(hidden)]
61 const SCHEME: &'static str;
64}
65
66pub trait MapErrorNumber {
fn map_error_number(error_number: u32)
-> DatabaseErrorKind;
}#[diesel_derives::__diesel_public_if(
67 feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
68)]
69pub(crate) trait MapErrorNumber {
70 #[cfg_attr(
73 not(any(
74 feature = "mysql",
75 feature = "mariadb",
76 feature = "i-implement-a-third-party-backend-and-opt-into-breaking-changes"
77 )),
78 expect(dead_code, reason = "only the connections call it")
79 )]
80 fn map_error_number(error_number: u32) -> DatabaseErrorKind;
81}
82
83#[derive(#[automatically_derived]
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]
impl ::core::hash::Hash for MysqlType {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
}
}Hash, #[automatically_derived]
impl ::core::marker::StructuralPartialEq for MysqlType { }
#[automatically_derived]
impl ::core::cmp::PartialEq for MysqlType {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for MysqlType { }Eq, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for MysqlType { }
#[automatically_derived]
impl ::core::clone::Clone for MysqlType {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlType { }Copy)]
86#[non_exhaustive]
87pub enum MysqlType {
88 Tiny,
90 UnsignedTiny,
92 Short,
94 UnsignedShort,
96 Long,
98 UnsignedLong,
100 LongLong,
102 UnsignedLongLong,
104 Float,
106 Double,
108 Numeric,
110 Time,
112 Date,
114 DateTime,
117 Timestamp,
120 String,
122 Blob,
124 Bit,
126 Set,
128 Enum,
130}
131
132pub(crate) mod query_fragments {
133 use crate::backend::sql_dialect::batch_update_support::SupportsBatchUpdate;
134 use crate::backend::sql_dialect::on_conflict_clause::SupportsOnConflictClause;
135
136 #[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]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for MysqlStyleDefaultValueClause { }
#[automatically_derived]
impl ::core::clone::Clone for MysqlStyleDefaultValueClause {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlStyleDefaultValueClause { }Copy)]
137 pub struct MysqlStyleDefaultValueClause;
138
139 #[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]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for MysqlConcatClause { }
#[automatically_derived]
impl ::core::clone::Clone for MysqlConcatClause {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlConcatClause { }Copy)]
140 pub struct MysqlConcatClause;
141
142 #[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]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for MysqlOnConflictClause { }
#[automatically_derived]
impl ::core::clone::Clone for MysqlOnConflictClause {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlOnConflictClause { }Copy)]
143 pub struct MysqlOnConflictClause;
144
145 #[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]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for
MysqlRequiresOrderForWindowFunctions {
}
#[automatically_derived]
impl ::core::clone::Clone for MysqlRequiresOrderForWindowFunctions {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MysqlRequiresOrderForWindowFunctions { }Copy)]
146 pub struct MysqlRequiresOrderForWindowFunctions;
147
148 impl SupportsOnConflictClause for MysqlOnConflictClause {}
149
150 #[derive(#[automatically_derived]
impl ::core::fmt::Debug for MySqlLikeBatchUpdateSupport {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "MySqlLikeBatchUpdateSupport")
}
}Debug, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for MySqlLikeBatchUpdateSupport { }
#[automatically_derived]
impl ::core::clone::Clone for MySqlLikeBatchUpdateSupport {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MySqlLikeBatchUpdateSupport { }Copy)]
151 pub struct MySqlLikeBatchUpdateSupport;
152
153 impl SupportsBatchUpdate for MySqlLikeBatchUpdateSupport {}
154}