Fix the signature of bind

This commit is contained in:
Ivan Ukhov 2015-06-19 13:10:09 -04:00
parent 28929e8f1b
commit fad63fc9d0

View File

@ -24,7 +24,7 @@ pub trait Parameter {
/// Bind the parameter at a specific location. /// Bind the parameter at a specific location.
/// ///
/// The leftmost location has the index 1. /// The leftmost location has the index 1.
fn bind(&self, &Statement, usize) -> Result<()>; fn bind(&self, &mut Statement, usize) -> Result<()>;
} }
/// A value stored in a prepared statement. /// A value stored in a prepared statement.
@ -78,7 +78,7 @@ impl<'l> Drop for Statement<'l> {
impl Parameter for f64 { impl Parameter for f64 {
#[inline] #[inline]
fn bind(&self, statement: &Statement, i: usize) -> Result<()> { fn bind(&self, statement: &mut Statement, i: usize) -> Result<()> {
debug_assert!(i > 0, "the indexing starts from 1"); debug_assert!(i > 0, "the indexing starts from 1");
unsafe { unsafe {
success!(statement.raw.1, ffi::sqlite3_bind_double(statement.raw.0, i as c_int, success!(statement.raw.1, ffi::sqlite3_bind_double(statement.raw.0, i as c_int,
@ -90,7 +90,7 @@ impl Parameter for f64 {
impl Parameter for i64 { impl Parameter for i64 {
#[inline] #[inline]
fn bind(&self, statement: &Statement, i: usize) -> Result<()> { fn bind(&self, statement: &mut Statement, i: usize) -> Result<()> {
debug_assert!(i > 0, "the indexing starts from 1"); debug_assert!(i > 0, "the indexing starts from 1");
unsafe { unsafe {
success!(statement.raw.1, ffi::sqlite3_bind_int64(statement.raw.0, i as c_int, success!(statement.raw.1, ffi::sqlite3_bind_int64(statement.raw.0, i as c_int,
@ -102,7 +102,7 @@ impl Parameter for i64 {
impl<'l> Parameter for &'l str { impl<'l> Parameter for &'l str {
#[inline] #[inline]
fn bind(&self, statement: &Statement, i: usize) -> Result<()> { fn bind(&self, statement: &mut Statement, i: usize) -> Result<()> {
debug_assert!(i > 0, "the indexing starts from 1"); debug_assert!(i > 0, "the indexing starts from 1");
unsafe { unsafe {
success!(statement.raw.1, ffi::sqlite3_bind_text(statement.raw.0, i as c_int, success!(statement.raw.1, ffi::sqlite3_bind_text(statement.raw.0, i as c_int,