This commit is contained in:
Kay Simmons 2023-01-20 12:15:21 -08:00
parent 81ed961659
commit 15799f7af6
17 changed files with 481 additions and 148 deletions

View file

@ -238,11 +238,14 @@ impl<'a> Statement<'a> {
pub fn bind<T: Bind>(&self, value: T, index: i32) -> Result<i32> {
debug_assert!(index > 0);
value.bind(self, index)
let after = value.bind(self, index)?;
debug_assert_eq!((after - index) as usize, value.column_count());
Ok(after)
}
pub fn column<T: Column>(&mut self) -> Result<T> {
let (result, _) = T::column(self, 0)?;
let (result, after) = T::column(self, 0)?;
debug_assert_eq!(T::column_count(&result), after as usize);
Ok(result)
}
@ -260,7 +263,9 @@ impl<'a> Statement<'a> {
}
pub fn with_bindings(&mut self, bindings: impl Bind) -> Result<&mut Self> {
self.bind(bindings, 1)?;
let column_count = bindings.column_count();
let after = self.bind(bindings, 1)?;
debug_assert_eq!((after - 1) as usize, column_count);
Ok(self)
}