File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 11use hyper:: { header:: CONTENT_LENGTH , Method , Request } ;
22use serde:: Deserialize ;
3- use std:: fmt;
3+ use std:: fmt:: Display ;
44use url:: Url ;
55
66use crate :: headers:: with_request_headers;
@@ -23,12 +23,6 @@ pub struct Query {
2323 sql : SqlBuilder ,
2424}
2525
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-
3226impl Query {
3327 pub ( crate ) fn new ( client : & Client , template : & str ) -> Self {
3428 Self {
@@ -37,6 +31,11 @@ impl Query {
3731 }
3832 }
3933
34+ /// Display SQL query as string.
35+ pub fn sql_display ( & self ) -> & impl Display {
36+ & self . sql
37+ }
38+
4039 /// Binds `value` to the next `?` in the query.
4140 ///
4241 /// The `value`, which must either implement [`Serialize`] or be an
Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ async fn prints_query() {
221221
222222 let q = client. query ( "SELECT ?fields FROM test WHERE a = ? AND b < ?" ) ;
223223 assert_eq ! (
224- format!( "{q:?}" ) ,
224+ format!( "{}" , q . sql_display ( ) ) ,
225225 "SELECT ?fields FROM test WHERE a = ? AND b < ?"
226226 ) ;
227227}
You can’t perform that action at this time.
0 commit comments