1
1
use crate :: stmt_cache:: { PrepareCallback , StmtCache } ;
2
- use crate :: {
3
- AnsiTransactionManager , AsyncConnection , AsyncConnectionGatWorkaround , SimpleAsyncConnection ,
4
- } ;
2
+ use crate :: { AnsiTransactionManager , AsyncConnection , SimpleAsyncConnection } ;
5
3
use diesel:: connection:: statement_cache:: MaybeCached ;
6
4
use diesel:: mysql:: { Mysql , MysqlType } ;
7
5
use diesel:: query_builder:: { bind_collector:: RawBytesBindCollector , QueryFragment , QueryId } ;
@@ -36,16 +34,7 @@ impl SimpleAsyncConnection for AsyncMysqlConnection {
36
34
}
37
35
}
38
36
39
- impl < ' conn , ' query > AsyncConnectionGatWorkaround < ' conn , ' query , Mysql > for AsyncMysqlConnection {
40
- type ExecuteFuture = BoxFuture < ' conn , QueryResult < usize > > ;
41
- type LoadFuture = BoxFuture < ' conn , QueryResult < Self :: Stream > > ;
42
- type Stream = BoxStream < ' conn , QueryResult < Self :: Row > > ;
43
-
44
- type Row = MysqlRow ;
45
- }
46
-
47
- const CONNECTION_SETUP_QUERIES : & ' static [ & ' static str ] = & [
48
- "SET sql_mode=(SELECT CONCAT(@@sql_mode, ',PIPES_AS_CONCAT'))" ,
37
+ const CONNECTION_SETUP_QUERIES : & [ & str ] = & [
49
38
"SET time_zone = '+00:00';" ,
50
39
"SET character_set_client = 'utf8mb4'" ,
51
40
"SET character_set_connection = 'utf8mb4'" ,
@@ -54,6 +43,10 @@ const CONNECTION_SETUP_QUERIES: &'static [&'static str] = &[
54
43
55
44
#[ async_trait:: async_trait]
56
45
impl AsyncConnection for AsyncMysqlConnection {
46
+ type ExecuteFuture < ' conn , ' query > = BoxFuture < ' conn , QueryResult < usize > > ;
47
+ type LoadFuture < ' conn , ' query > = BoxFuture < ' conn , QueryResult < Self :: Stream < ' conn , ' query > > > ;
48
+ type Stream < ' conn , ' query > = BoxStream < ' conn , QueryResult < Self :: Row < ' conn , ' query > > > ;
49
+ type Row < ' conn , ' query > = MysqlRow ;
57
50
type Backend = Mysql ;
58
51
59
52
type TransactionManager = AnsiTransactionManager ;
@@ -74,10 +67,7 @@ impl AsyncConnection for AsyncMysqlConnection {
74
67
} )
75
68
}
76
69
77
- fn load < ' conn , ' query , T > (
78
- & ' conn mut self ,
79
- source : T ,
80
- ) -> <Self as AsyncConnectionGatWorkaround < ' conn , ' query , Self :: Backend > >:: LoadFuture
70
+ fn load < ' conn , ' query , T > ( & ' conn mut self , source : T ) -> Self :: LoadFuture < ' conn , ' query >
81
71
where
82
72
T : diesel:: query_builder:: AsQuery + Send ,
83
73
T :: Query : diesel:: query_builder:: QueryFragment < Self :: Backend >
@@ -133,7 +123,7 @@ impl AsyncConnection for AsyncMysqlConnection {
133
123
fn execute_returning_count < ' conn , ' query , T > (
134
124
& ' conn mut self ,
135
125
source : T ,
136
- ) -> < Self as AsyncConnectionGatWorkaround < ' conn , ' query , Self :: Backend > > :: ExecuteFuture
126
+ ) -> Self :: ExecuteFuture < ' conn , ' query >
137
127
where
138
128
T : diesel:: query_builder:: QueryFragment < Self :: Backend >
139
129
+ diesel:: query_builder:: QueryId
@@ -248,11 +238,10 @@ impl AsyncMysqlConnection {
248
238
let stmt = stmt_cache. cached_prepared_statement ( query, & metadata, conn, & Mysql ) ;
249
239
250
240
stmt. and_then ( |( stmt, conn) | async move {
251
- let res = update_transaction_manager_status (
241
+ update_transaction_manager_status (
252
242
callback ( conn, stmt, ToSqlHelper { metadata, binds } ) . await ,
253
243
transaction_manager,
254
- ) ;
255
- res
244
+ )
256
245
} )
257
246
. boxed ( )
258
247
}
0 commit comments