Stmt

Struct Stmt 

Source
#[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: i32

Implementations§

Source§

impl Stmt

Source

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

Source

pub fn close(&mut self)

Close the statement

Source

pub unsafe fn from_ptr(ptr: *mut Stmt) -> ExtResult<&'static mut Self>

§Safety

Derefs a null ptr, does a null check first

Source

pub fn to_ptr(&self) -> *mut Stmt

Returns the pointer to the statement.

Source

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.

Source

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

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.