#[repr(C)]pub struct Stmt {
pub _conn: *mut c_void,
pub _ctx: *mut c_void,
pub _bind_args_fn: unsafe extern "C" fn(ctx: *mut Stmt, idx: i32, arg: Value) -> ResultCode,
pub _step: unsafe extern "C" fn(ctx: *mut Stmt) -> ResultCode,
pub _get_row_values: unsafe extern "C" fn(ctx: *mut Stmt),
pub _get_column_names: unsafe extern "C" fn(ctx: *mut Stmt, count: *mut i32) -> *mut *mut c_char,
pub _free_current_row: unsafe extern "C" fn(ctx: *mut Stmt),
pub _close: unsafe extern "C" fn(ctx: *mut Stmt),
pub current_row: *mut Value,
pub current_row_len: i32,
}Expand description
Internal/core use only Extensions should not import or use this type directly
Fields§
§_conn: *mut c_void§_ctx: *mut c_void§_bind_args_fn: unsafe extern "C" fn(ctx: *mut Stmt, idx: i32, arg: Value) -> ResultCode§_step: unsafe extern "C" fn(ctx: *mut Stmt) -> ResultCode§_get_row_values: unsafe extern "C" fn(ctx: *mut Stmt)§_get_column_names: unsafe extern "C" fn(ctx: *mut Stmt, count: *mut i32) -> *mut *mut c_char§_free_current_row: unsafe extern "C" fn(ctx: *mut Stmt)§_close: unsafe extern "C" fn(ctx: *mut Stmt)§current_row: *mut Value§current_row_len: i32Implementations§
Source§impl Stmt
impl Stmt
pub fn new( conn: *mut c_void, ctx: *mut c_void, bind: unsafe extern "C" fn(ctx: *mut Stmt, idx: i32, arg: Value) -> ResultCode, step: unsafe extern "C" fn(ctx: *mut Stmt) -> ResultCode, rows: unsafe extern "C" fn(ctx: *mut Stmt), names: unsafe extern "C" fn(ctx: *mut Stmt, count: *mut i32) -> *mut *mut c_char, free_row: unsafe extern "C" fn(ctx: *mut Stmt), close: unsafe extern "C" fn(ctx: *mut Stmt), ) -> Self
Sourcepub unsafe fn from_ptr(ptr: *mut Stmt) -> ExtResult<&'static mut Self>
pub unsafe fn from_ptr(ptr: *mut Stmt) -> ExtResult<&'static mut Self>
§Safety
Derefs a null ptr, does a null check first
Sourcepub unsafe fn free_current_row(&mut self)
pub unsafe fn free_current_row(&mut self)
Free the memory for the values obtained from the get_row method.
This is easier done on core side because __free_internal_type is ‘core_only’
feature to prevent extensions causing memory issues.
§Safety
This fn is unsafe because it derefs a raw pointer after null and length checks. This fn should only be called with the pointer returned from get_row.
Sourcepub fn get_row(&self) -> &[Value]
pub fn get_row(&self) -> &[Value]
Returns the values from the current row in the prepared statement, should
be called after the step() method returns StepResult::Row
Sourcepub fn get_column_names(&self) -> Vec<String>
pub fn get_column_names(&self) -> Vec<String>
Returns the names of the result columns for the prepared statement.
Auto Trait Implementations§
impl Freeze for Stmt
impl RefUnwindSafe for Stmt
impl !Send for Stmt
impl !Sync for Stmt
impl Unpin for Stmt
impl UnwindSafe for Stmt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more