diff --git a/src/statement.rs b/src/statement.rs index 182f587..14d6a39 100755 --- a/src/statement.rs +++ b/src/statement.rs @@ -120,14 +120,18 @@ impl<'conn> Statement<'conn> { /// parameters, however this is not yet available through this crate. /// pub fn bind(&mut self, params: &[&ToSqlValue]) -> Result<(), OciError> { + // clear out previous bind parameters self.values.clear(); + + // ensure that the vec is large enough to hold all the parameters + // otherwise the vec will re-size, re-allocated and the addresses will change + self.values.reserve(params.len()); for (index, param) in params.iter().enumerate() { let sql_value = param.to_sql_value(); self.values.push(sql_value); let binding: *mut OCIBind = ptr::null_mut(); self.bindings.push(binding); - let position = (index + 1) as c_uint; let null_mut_ptr = ptr::null_mut(); let indp = null_mut_ptr; diff --git a/src/types.rs b/src/types.rs index f90c289..87e4983 100755 --- a/src/types.rs +++ b/src/types.rs @@ -6,7 +6,7 @@ use oci_error::OciError; /// The types that support conversion from OCI to Rust types. /// -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Clone)] pub enum SqlValue { /// Anything specified as `VARCHAR` or `VARCHAR2` will end up here. VarChar(String),