1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use super::ParameterRefCollection;
use crate::{handles::Statement, Error, ParameterRef};
macro_rules! impl_bind_parameters {
($offset:expr, $stmt:ident) => (
Ok(())
);
($offset:expr, $stmt:ident $head:ident $($tail:ident)*) => (
{
$head.bind_to($offset+1, $stmt)?;
impl_bind_parameters!($offset+1, $stmt $($tail)*)
}
);
}
macro_rules! impl_parameters_for_tuple{
($($t:ident)*) => (
#[allow(unused_parens)]
#[allow(unused_variables)]
#[allow(non_snake_case)]
unsafe impl<$($t:ParameterRef,)*> ParameterRefCollection for ($($t,)*)
{
fn parameter_set_size(&self) -> usize {
1
}
unsafe fn bind_parameters_to(&mut self, stmt: &mut impl Statement) -> Result<(), Error> {
let ($($t,)*) = self;
impl_bind_parameters!(0, stmt $($t)*)
}
}
);
}
impl_parameters_for_tuple! {}
impl_parameters_for_tuple! { A }
impl_parameters_for_tuple! { A B }
impl_parameters_for_tuple! { A B C }
impl_parameters_for_tuple! { A B C D }
impl_parameters_for_tuple! { A B C D E }
impl_parameters_for_tuple! { A B C D E F }
impl_parameters_for_tuple! { A B C D E F G }
impl_parameters_for_tuple! { A B C D E F G H }
impl_parameters_for_tuple! { A B C D E F G H I }
impl_parameters_for_tuple! { A B C D E F G H I J }