quackdb_internal/handles/
statement.rsuse std::{ops::Deref, sync::Arc};
use crate::ffi;
use super::ConnectionHandle;
#[derive(Debug)]
pub struct PreparedStatementHandle {
raw: ffi::duckdb_prepared_statement,
_parent: Arc<ConnectionHandle>,
}
impl Deref for PreparedStatementHandle {
type Target = ffi::duckdb_prepared_statement;
fn deref(&self) -> &Self::Target {
&self.raw
}
}
impl Drop for PreparedStatementHandle {
fn drop(&mut self) {
unsafe { ffi::duckdb_destroy_prepare(&mut self.raw) }
}
}
impl PreparedStatementHandle {
pub unsafe fn from_raw(
raw: ffi::duckdb_prepared_statement,
parent: Arc<ConnectionHandle>,
) -> Arc<Self> {
Arc::new(Self {
raw,
_parent: parent,
})
}
}