Make StatementCache hold RawStatements instead of Statements.

This commit is contained in:
John Gallagher
2016-05-17 11:55:10 -05:00
parent f6aba80f4b
commit 1978568d01
2 changed files with 17 additions and 16 deletions

View File

@@ -901,17 +901,6 @@ impl<'conn> Statement<'conn> {
Ok(())
}
#[cfg(feature = "cache")]
fn clear_bindings(&mut self) {
self.stmt.clear_bindings();
}
#[cfg(feature = "cache")]
fn eq(&self, sql: &str) -> bool {
let c_slice = self.stmt.sql().to_bytes();
sql.as_bytes().eq(c_slice)
}
fn finalize_(&mut self) -> Result<()> {
let mut stmt = RawStatement::new(ptr::null_mut());
mem::swap(&mut stmt, &mut self.stmt);
@@ -919,6 +908,14 @@ impl<'conn> Statement<'conn> {
}
}
impl<'conn> Into<RawStatement> for Statement<'conn> {
fn into(mut self) -> RawStatement {
let mut stmt = RawStatement::new(ptr::null_mut());
mem::swap(&mut stmt, &mut self.stmt);
stmt
}
}
impl<'conn> fmt::Debug for Statement<'conn> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let sql = str::from_utf8(self.stmt.sql().to_bytes());