Move parameter count assertion above format encoding derivation

This commit is contained in:
Alex Pearson 2022-08-15 20:54:11 -04:00
parent 569689deaa
commit 8158eed052

View File

@ -157,11 +157,6 @@ where
I::IntoIter: ExactSizeIterator, I::IntoIter: ExactSizeIterator,
{ {
let param_types = statement.params(); let param_types = statement.params();
let (param_formats, params): (Vec<_>, Vec<_>) = params
.into_iter()
.zip(param_types.iter())
.map(|(p, ty)| (p.borrow_to_sql().encode_format(ty) as i16, p))
.unzip();
let params = params.into_iter(); let params = params.into_iter();
assert!( assert!(
@ -171,6 +166,13 @@ where
params.len() params.len()
); );
let (param_formats, params): (Vec<_>, Vec<_>) = params
.zip(param_types.iter())
.map(|(p, ty)| (p.borrow_to_sql().encode_format(ty) as i16, p))
.unzip();
let params = params.into_iter();
let mut error_idx = 0; let mut error_idx = 0;
let r = frontend::bind( let r = frontend::bind(
portal, portal,