File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -3620,7 +3620,7 @@ mod mssql {
3620
3620
. columns ( )
3621
3621
. await ?
3622
3622
. unwrap_or_default ( )
3623
- . into_iter ( )
3623
+ . iter ( )
3624
3624
. map ( |c| c. name ( ) . to_owned ( ) )
3625
3625
. collect ( ) ;
3626
3626
@@ -3690,7 +3690,28 @@ mod mssql {
3690
3690
}
3691
3691
3692
3692
async fn query ( & self , query : String ) -> color_eyre:: Result < responses:: Query > {
3693
- todo ! ( )
3693
+ let mut client = self . client . lock ( ) . await ;
3694
+
3695
+ let mut query = client. query ( query, & [ ] ) . await ?;
3696
+ let columns: Vec < String > = query
3697
+ . columns ( )
3698
+ . await ?
3699
+ . unwrap_or_default ( )
3700
+ . iter ( )
3701
+ . map ( |c| c. name ( ) . to_owned ( ) )
3702
+ . collect ( ) ;
3703
+
3704
+ let rows = tokio:: time:: timeout (
3705
+ self . query_timeout ,
3706
+ query
3707
+ . into_row_stream ( )
3708
+ . map_ok ( |row| row. into_iter ( ) . map ( mssql_value_to_json) . collect :: < Vec < _ > > ( ) )
3709
+ . filter_map ( |count| async { count. ok ( ) } )
3710
+ . collect :: < Vec < _ > > ( ) ,
3711
+ )
3712
+ . await ?;
3713
+
3714
+ Ok ( responses:: Query { columns, rows } )
3694
3715
}
3695
3716
}
3696
3717
}
You can’t perform that action at this time.
0 commit comments