mirror of
https://github.com/isar/rusqlite.git
synced 2025-12-08 12:32:24 +08:00
Rework ToSql to be implementable without unsafe.
This commit is contained in:
@@ -204,12 +204,7 @@ impl<'conn> Statement<'conn> {
|
||||
fn bind_parameters_named(&mut self, params: &[(&str, &ToSql)]) -> Result<()> {
|
||||
for &(name, value) in params {
|
||||
if let Some(i) = try!(self.parameter_index(name)) {
|
||||
try!(self.conn.decode_result(unsafe {
|
||||
// This should be
|
||||
// `value.bind_parameter(self.stmt.ptr(), i)`
|
||||
// but that doesn't compile until Rust 1.9 due to a compiler bug.
|
||||
ToSql::bind_parameter(value, self.stmt.ptr(), i)
|
||||
}));
|
||||
try!(self.bind_parameter(value, i));
|
||||
} else {
|
||||
return Err(Error::InvalidParameterName(name.into()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user