@@ -135,6 +135,29 @@ macro_rules! query (
135
135
} )
136
136
) ;
137
137
138
+ /// A variant of [query!] which does not check the input or output types. This still does parse
139
+ /// the query to ensure it's syntactically and semantically valid for the current database.
140
+ #[ macro_export]
141
+ #[ cfg_attr( docsrs, doc( cfg( feature = "macros" ) ) ) ]
142
+ macro_rules! query_unchecked (
143
+ // by emitting a macro definition from our proc-macro containing the result tokens,
144
+ // we no longer have a need for `proc-macro-hack`
145
+ ( $query: literal) => ( {
146
+ #[ macro_use]
147
+ mod _macro_result {
148
+ $crate:: sqlx_macros:: query_unchecked!( $query) ;
149
+ }
150
+ macro_result!( )
151
+ } ) ;
152
+ ( $query: literal, $( $args: expr) ,* $( , ) ?) => ( {
153
+ #[ macro_use]
154
+ mod _macro_result {
155
+ $crate:: sqlx_macros:: query_unchecked!( $query, $( $args) ,* ) ;
156
+ }
157
+ macro_result!( $( $args) ,* )
158
+ } )
159
+ ) ;
160
+
138
161
/// A variant of [query!] where the SQL query is stored in a separate file.
139
162
///
140
163
/// Useful for large queries and potentially cleaner than multiline strings.
@@ -196,6 +219,27 @@ macro_rules! query_file (
196
219
} )
197
220
) ;
198
221
222
+ /// A variant of [query_file!] which does not check the input or output types. This still does parse
223
+ /// the query to ensure it's syntactically and semantically valid for the current database.
224
+ #[ macro_export]
225
+ #[ cfg_attr( docsrs, doc( cfg( feature = "macros" ) ) ) ]
226
+ macro_rules! query_file_unchecked (
227
+ ( $query: literal) => ( #[ allow( dead_code) ] {
228
+ #[ macro_use]
229
+ mod _macro_result {
230
+ $crate:: sqlx_macros:: query_file_unchecked!( $query) ;
231
+ }
232
+ macro_result!( )
233
+ } ) ;
234
+ ( $query: literal, $( $args: expr) ,* $( , ) ?) => ( #[ allow( dead_code) ] {
235
+ #[ macro_use]
236
+ mod _macro_result {
237
+ $crate:: sqlx_macros:: query_file_unchecked!( $query, $( $args) ,* ) ;
238
+ }
239
+ macro_result!( $( $args) ,* )
240
+ } )
241
+ ) ;
242
+
199
243
/// A variant of [query!] which takes a path to an explicitly defined struct as the output type.
200
244
///
201
245
/// This lets you return the struct from a function or add your own trait implementations.
0 commit comments