mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 18:40:24 +00:00
support string concatenation in query*
This commit is contained in:
committed by
Austin Bonander
parent
2e3e5187f9
commit
0a74b16f4f
@@ -257,14 +257,14 @@
|
||||
macro_rules! query (
|
||||
// by emitting a macro definition from our proc-macro containing the result tokens,
|
||||
// we no longer have a need for `proc-macro-hack`
|
||||
($query:literal) => ({
|
||||
($query:expr) => ({
|
||||
#[macro_use]
|
||||
mod _macro_result {
|
||||
$crate::sqlx_macros::expand_query!(source = $query);
|
||||
}
|
||||
macro_result!()
|
||||
});
|
||||
($query:literal, $($args:expr),*$(,)?) => ({
|
||||
($query:expr, $($args:expr),*$(,)?) => ({
|
||||
#[macro_use]
|
||||
mod _macro_result {
|
||||
$crate::sqlx_macros::expand_query!(source = $query, args = [$($args),*]);
|
||||
@@ -278,14 +278,14 @@ macro_rules! query (
|
||||
#[macro_export]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
macro_rules! query_unchecked (
|
||||
($query:literal) => ({
|
||||
($query:expr) => ({
|
||||
#[macro_use]
|
||||
mod _macro_result {
|
||||
$crate::sqlx_macros::expand_query!(source = $query, checked = false);
|
||||
}
|
||||
macro_result!()
|
||||
});
|
||||
($query:literal, $($args:expr),*$(,)?) => ({
|
||||
($query:expr, $($args:expr),*$(,)?) => ({
|
||||
#[macro_use]
|
||||
mod _macro_result {
|
||||
$crate::sqlx_macros::expand_query!(source = $query, args = [$($args),*], checked = false);
|
||||
@@ -461,14 +461,14 @@ macro_rules! query_file_unchecked (
|
||||
#[macro_export]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
macro_rules! query_as (
|
||||
($out_struct:path, $query:literal) => (#[allow(dead_code)] {
|
||||
($out_struct:path, $query:expr) => (#[allow(dead_code)] {
|
||||
#[macro_use]
|
||||
mod _macro_result {
|
||||
$crate::sqlx_macros::expand_query!(record = $out_struct, source = $query);
|
||||
}
|
||||
macro_result!()
|
||||
});
|
||||
($out_struct:path, $query:literal, $($args:expr),*$(,)?) => (#[allow(dead_code)] {
|
||||
($out_struct:path, $query:expr, $($args:expr),*$(,)?) => (#[allow(dead_code)] {
|
||||
#[macro_use]
|
||||
mod _macro_result {
|
||||
$crate::sqlx_macros::expand_query!(record = $out_struct, source = $query, args = [$($args),*]);
|
||||
@@ -534,7 +534,7 @@ macro_rules! query_file_as (
|
||||
#[macro_export]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
macro_rules! query_as_unchecked (
|
||||
($out_struct:path, $query:literal) => (#[allow(dead_code)] {
|
||||
($out_struct:path, $query:expr) => (#[allow(dead_code)] {
|
||||
#[macro_use]
|
||||
mod _macro_result {
|
||||
$crate::sqlx_macros::expand_query!(record = $out_struct, source = $query, checked = false);
|
||||
@@ -542,7 +542,7 @@ macro_rules! query_as_unchecked (
|
||||
macro_result!()
|
||||
});
|
||||
|
||||
($out_struct:path, $query:literal, $($args:expr),*$(,)?) => (#[allow(dead_code)] {
|
||||
($out_struct:path, $query:expr, $($args:expr),*$(,)?) => (#[allow(dead_code)] {
|
||||
#[macro_use]
|
||||
mod _macro_result {
|
||||
$crate::sqlx_macros::expand_query!(record = $out_struct, source = $query, args = [$($args),*], checked = false);
|
||||
|
||||
Reference in New Issue
Block a user