Skip to main content

Sqlite3Hooks

Trait Sqlite3Hooks 

Source
pub unsafe trait Sqlite3Hooks: Sqlite3Api {
    // Required methods
    unsafe fn trace_v2(
        &self,
        db: NonNull<Self::Db>,
        mask: u32,
        callback: Option<extern "C" fn(u32, *mut c_void, *mut c_void, *mut c_void)>,
        context: *mut c_void,
    ) -> Result<()>;
    unsafe fn progress_handler(
        &self,
        db: NonNull<Self::Db>,
        n: i32,
        callback: Option<extern "C" fn(*mut c_void) -> i32>,
        context: *mut c_void,
    ) -> Result<()>;
    unsafe fn busy_timeout(&self, db: NonNull<Self::Db>, ms: i32) -> Result<()>;
    unsafe fn set_authorizer(
        &self,
        db: NonNull<Self::Db>,
        callback: Option<extern "C" fn(*mut c_void, i32, *const c_char, *const c_char, *const c_char, *const c_char) -> i32>,
        context: *mut c_void,
    ) -> Result<()>;
}
Expand description

Optional backend extension for hooks (trace/progress/busy/authorizer).

§Safety

Implementations must keep callback/context pointers valid per SQLite’s hook registration contract and ensure callback ABI compatibility.

Required Methods§

Source

unsafe fn trace_v2( &self, db: NonNull<Self::Db>, mask: u32, callback: Option<extern "C" fn(u32, *mut c_void, *mut c_void, *mut c_void)>, context: *mut c_void, ) -> Result<()>

Register or clear a sqlite3_trace_v2 callback.

Source

unsafe fn progress_handler( &self, db: NonNull<Self::Db>, n: i32, callback: Option<extern "C" fn(*mut c_void) -> i32>, context: *mut c_void, ) -> Result<()>

Register or clear a progress handler callback.

Source

unsafe fn busy_timeout(&self, db: NonNull<Self::Db>, ms: i32) -> Result<()>

Set busy timeout in milliseconds.

Source

unsafe fn set_authorizer( &self, db: NonNull<Self::Db>, callback: Option<extern "C" fn(*mut c_void, i32, *const c_char, *const c_char, *const c_char, *const c_char) -> i32>, context: *mut c_void, ) -> Result<()>

Register or clear an authorizer callback.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§