File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 1
1
use hyper:: { header:: CONTENT_LENGTH , Method , Request } ;
2
2
use serde:: Deserialize ;
3
+ use std:: fmt;
3
4
use url:: Url ;
4
5
5
6
use crate :: headers:: with_request_headers;
@@ -22,6 +23,12 @@ pub struct Query {
22
23
sql : SqlBuilder ,
23
24
}
24
25
26
+ impl fmt:: Debug for Query {
27
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
28
+ write ! ( f, "{sql}" , sql = self . sql)
29
+ }
30
+ }
31
+
25
32
impl Query {
26
33
pub ( crate ) fn new ( client : & Client , template : & str ) -> Self {
27
34
Self {
Original file line number Diff line number Diff line change @@ -214,3 +214,14 @@ async fn overrides_client_options() {
214
214
// should override the client options
215
215
assert_eq ! ( value, override_value) ;
216
216
}
217
+
218
+ #[ tokio:: test]
219
+ async fn prints_query ( ) {
220
+ let client = prepare_database ! ( ) ;
221
+
222
+ let q = client. query ( "SELECT ?fields FROM test WHERE a = ? AND b < ?" ) ;
223
+ assert_eq ! (
224
+ format!( "{q:?}" ) ,
225
+ "SELECT ?fields FROM test WHERE a = ? AND b < ?"
226
+ ) ;
227
+ }
You can’t perform that action at this time.
0 commit comments