11use crate :: stmt_cache:: { PrepareCallback , StmtCache } ;
2- use crate :: {
3- AnsiTransactionManager , AsyncConnection , AsyncConnectionGatWorkaround , SimpleAsyncConnection ,
4- } ;
2+ use crate :: { AnsiTransactionManager , AsyncConnection , SimpleAsyncConnection } ;
53use diesel:: connection:: statement_cache:: MaybeCached ;
64use diesel:: mysql:: { Mysql , MysqlType } ;
75use diesel:: query_builder:: { bind_collector:: RawBytesBindCollector , QueryFragment , QueryId } ;
@@ -36,16 +34,7 @@ impl SimpleAsyncConnection for AsyncMysqlConnection {
3634 }
3735}
3836
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 ] = & [
4938 "SET time_zone = '+00:00';" ,
5039 "SET character_set_client = 'utf8mb4'" ,
5140 "SET character_set_connection = 'utf8mb4'" ,
@@ -54,6 +43,10 @@ const CONNECTION_SETUP_QUERIES: &'static [&'static str] = &[
5443
5544#[ async_trait:: async_trait]
5645impl 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 ;
5750 type Backend = Mysql ;
5851
5952 type TransactionManager = AnsiTransactionManager ;
@@ -74,10 +67,7 @@ impl AsyncConnection for AsyncMysqlConnection {
7467 } )
7568 }
7669
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 >
8171 where
8272 T : diesel:: query_builder:: AsQuery + Send ,
8373 T :: Query : diesel:: query_builder:: QueryFragment < Self :: Backend >
@@ -133,7 +123,7 @@ impl AsyncConnection for AsyncMysqlConnection {
133123 fn execute_returning_count < ' conn , ' query , T > (
134124 & ' conn mut self ,
135125 source : T ,
136- ) -> < Self as AsyncConnectionGatWorkaround < ' conn , ' query , Self :: Backend > > :: ExecuteFuture
126+ ) -> Self :: ExecuteFuture < ' conn , ' query >
137127 where
138128 T : diesel:: query_builder:: QueryFragment < Self :: Backend >
139129 + diesel:: query_builder:: QueryId
@@ -248,11 +238,10 @@ impl AsyncMysqlConnection {
248238 let stmt = stmt_cache. cached_prepared_statement ( query, & metadata, conn, & Mysql ) ;
249239
250240 stmt. and_then ( |( stmt, conn) | async move {
251- let res = update_transaction_manager_status (
241+ update_transaction_manager_status (
252242 callback ( conn, stmt, ToSqlHelper { metadata, binds } ) . await ,
253243 transaction_manager,
254- ) ;
255- res
244+ )
256245 } )
257246 . boxed ( )
258247 }
0 commit comments