Commit ac1d8a1 1 parent 7cf0c00 commit ac1d8a1 Copy full SHA for ac1d8a1
File tree 5 files changed +12
-7
lines changed
sqlx-core/src/any/connection
5 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -72,12 +72,14 @@ pub trait AnyConnectionBackend: std::any::Any + Debug + Send + 'static {
72
72
fn fetch_many < ' q > (
73
73
& ' q mut self ,
74
74
query : & ' q str ,
75
+ persistent : bool ,
75
76
arguments : Option < AnyArguments < ' q > > ,
76
77
) -> BoxStream < ' q , crate :: Result < Either < AnyQueryResult , AnyRow > > > ;
77
78
78
79
fn fetch_optional < ' q > (
79
80
& ' q mut self ,
80
81
query : & ' q str ,
82
+ persistent : bool ,
81
83
arguments : Option < AnyArguments < ' q > > ,
82
84
) -> BoxFuture < ' q , crate :: Result < Option < AnyRow > > > ;
83
85
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ impl<'c> Executor<'c> for &'c mut AnyConnection {
23
23
Ok ( arguments) => arguments,
24
24
Err ( error) => return stream:: once ( future:: ready ( Err ( error) ) ) . boxed ( ) ,
25
25
} ;
26
- self . backend . fetch_many ( query. sql ( ) , arguments)
26
+ self . backend . fetch_many ( query. sql ( ) , query . persistent ( ) , arguments)
27
27
}
28
28
29
29
fn fetch_optional < ' e , ' q : ' e , E > (
@@ -38,7 +38,7 @@ impl<'c> Executor<'c> for &'c mut AnyConnection {
38
38
Ok ( arguments) => arguments,
39
39
Err ( error) => return future:: ready ( Err ( error) ) . boxed ( ) ,
40
40
} ;
41
- self . backend . fetch_optional ( query. sql ( ) , arguments)
41
+ self . backend . fetch_optional ( query. sql ( ) , query . persistent ( ) , arguments)
42
42
}
43
43
44
44
fn prepare_with < ' e , ' q : ' e > (
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ impl AnyConnectionBackend for MySqlConnection {
75
75
fn fetch_many < ' q > (
76
76
& ' q mut self ,
77
77
query : & ' q str ,
78
+ persistent : bool ,
78
79
arguments : Option < AnyArguments < ' q > > ,
79
80
) -> BoxStream < ' q , sqlx_core:: Result < Either < AnyQueryResult , AnyRow > > > {
80
81
let persistent = arguments. is_some ( ) ;
@@ -100,9 +101,9 @@ impl AnyConnectionBackend for MySqlConnection {
100
101
fn fetch_optional < ' q > (
101
102
& ' q mut self ,
102
103
query : & ' q str ,
104
+ persistent : bool ,
103
105
arguments : Option < AnyArguments < ' q > > ,
104
106
) -> BoxFuture < ' q , sqlx_core:: Result < Option < AnyRow > > > {
105
- let persistent = arguments. is_some ( ) ;
106
107
let arguments = arguments
107
108
. as_ref ( )
108
109
. map ( AnyArguments :: convert_to)
Original file line number Diff line number Diff line change @@ -74,9 +74,9 @@ impl AnyConnectionBackend for PgConnection {
74
74
fn fetch_many < ' q > (
75
75
& ' q mut self ,
76
76
query : & ' q str ,
77
+ persistent : bool ,
77
78
arguments : Option < AnyArguments < ' q > > ,
78
79
) -> BoxStream < ' q , sqlx_core:: Result < Either < AnyQueryResult , AnyRow > > > {
79
- let persistent = arguments. is_some ( ) ;
80
80
let arguments = match arguments. as_ref ( ) . map ( AnyArguments :: convert_to) . transpose ( ) {
81
81
Ok ( arguments) => arguments,
82
82
Err ( error) => {
@@ -99,9 +99,9 @@ impl AnyConnectionBackend for PgConnection {
99
99
fn fetch_optional < ' q > (
100
100
& ' q mut self ,
101
101
query : & ' q str ,
102
+ persistent : bool ,
102
103
arguments : Option < AnyArguments < ' q > > ,
103
104
) -> BoxFuture < ' q , sqlx_core:: Result < Option < AnyRow > > > {
104
- let persistent = arguments. is_some ( ) ;
105
105
let arguments = arguments
106
106
. as_ref ( )
107
107
. map ( AnyArguments :: convert_to)
Original file line number Diff line number Diff line change @@ -75,10 +75,11 @@ impl AnyConnectionBackend for SqliteConnection {
75
75
fn fetch_many < ' q > (
76
76
& ' q mut self ,
77
77
query : & ' q str ,
78
+ persistent : bool ,
78
79
arguments : Option < AnyArguments < ' q > > ,
79
80
) -> BoxStream < ' q , sqlx_core:: Result < Either < AnyQueryResult , AnyRow > > > {
80
- let persistent = arguments. is_some ( ) ;
81
81
let args = arguments. map ( map_arguments) ;
82
+ let persistent = persistent && args. is_some ( ) ;
82
83
83
84
Box :: pin (
84
85
self . worker
@@ -97,10 +98,11 @@ impl AnyConnectionBackend for SqliteConnection {
97
98
fn fetch_optional < ' q > (
98
99
& ' q mut self ,
99
100
query : & ' q str ,
101
+ persistent : bool ,
100
102
arguments : Option < AnyArguments < ' q > > ,
101
103
) -> BoxFuture < ' q , sqlx_core:: Result < Option < AnyRow > > > {
102
- let persistent = arguments. is_some ( ) ;
103
104
let args = arguments. map ( map_arguments) ;
105
+ let persistent = persistent && args. is_some ( ) ;
104
106
105
107
Box :: pin ( async move {
106
108
let stream = self
You can’t perform that action at this time.
0 commit comments