From 635bb3e8f14d49b51d901b9134aff98a1012aaec Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Sat, 27 Feb 2021 00:50:02 -0800 Subject: [PATCH] fix(core): show argument index as starting from 0 --- sqlx-core/src/arguments.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlx-core/src/arguments.rs b/sqlx-core/src/arguments.rs index 3efb1541..499c747c 100644 --- a/sqlx-core/src/arguments.rs +++ b/sqlx-core/src/arguments.rs @@ -75,7 +75,7 @@ impl<'a, Db: Database> Arguments<'a, Db> { /// and you attempt to bind a `&str` in Rust, an incompatible type error will be raised. /// pub fn add>(&mut self, value: &'a T) { - let index = self.positional.len() + 1; + let index = self.positional.len(); self.positional.push(Argument::new(Either::Left(index), value, false)); } @@ -87,7 +87,7 @@ impl<'a, Db: Database> Arguments<'a, Db> { /// will not be hinted when preparing the statement. /// pub fn add_unchecked>(&mut self, value: &'a T) { - let index = self.positional.len() + 1; + let index = self.positional.len(); self.positional.push(Argument::new(Either::Left(index), value, true)); }