pub struct Connection<'p, P: Sqlite3Api> { /* private fields */ }Expand description
Safe wrapper around a sqlite3* connection.
Implementations§
Source§impl<'p, P: Sqlite3Api> Connection<'p, P>
impl<'p, P: Sqlite3Api> Connection<'p, P>
Sourcepub fn open(
api: &'p P,
filename: &str,
options: OpenOptions<'_>,
) -> Result<Self>
pub fn open( api: &'p P, filename: &str, options: OpenOptions<'_>, ) -> Result<Self>
Open a connection using the provider SPI.
Sourcepub fn prepare(&self, sql: &str) -> Result<Statement<'_, 'p, P>>
pub fn prepare(&self, sql: &str) -> Result<Statement<'_, 'p, P>>
Prepare a statement, using prepare_v3 when available.
Sourcepub fn prepare_with_flags(
&self,
sql: &str,
flags: u32,
) -> Result<Statement<'_, 'p, P>>
pub fn prepare_with_flags( &self, sql: &str, flags: u32, ) -> Result<Statement<'_, 'p, P>>
Prepare a statement with flags (requires prepare_v3 support).
Sourcepub fn raw_handle(&self) -> NonNull<P::Db>
pub fn raw_handle(&self) -> NonNull<P::Db>
Expose the raw database handle.
Source§impl<'p, P: Sqlite3Keying> Connection<'p, P>
impl<'p, P: Sqlite3Keying> Connection<'p, P>
Source§impl<'p, P: Sqlite3Hooks> Connection<'p, P>
impl<'p, P: Sqlite3Hooks> Connection<'p, P>
Sourcepub fn busy_timeout(&self, ms: i32) -> Result<()>
pub fn busy_timeout(&self, ms: i32) -> Result<()>
Set busy timeout.
Sourcepub unsafe fn progress_handler(
&self,
n: i32,
cb: Option<extern "C" fn() -> i32>,
ctx: *mut c_void,
) -> Result<()>
pub unsafe fn progress_handler( &self, n: i32, cb: Option<extern "C" fn() -> i32>, ctx: *mut c_void, ) -> Result<()>
Register a progress handler.
§Safety
ctx must point to callback state that remains valid until the progress
handler is replaced/cleared, and cb must uphold SQLite’s callback ABI.
Sourcepub fn register_trace<F>(
&self,
mask: TraceMask,
f: F,
) -> Result<CallbackHandle<'p, P>>
pub fn register_trace<F>( &self, mask: TraceMask, f: F, ) -> Result<CallbackHandle<'p, P>>
Register a typed trace callback.
Register a typed authorizer callback.
Source§impl<'p, P: Sqlite3Backup> Connection<'p, P>
impl<'p, P: Sqlite3Backup> Connection<'p, P>
Source§impl<'p, P: Sqlite3BlobIo> Connection<'p, P>
impl<'p, P: Sqlite3BlobIo> Connection<'p, P>
Source§impl<'p, P: Sqlite3Serialize> Connection<'p, P>
impl<'p, P: Sqlite3Serialize> Connection<'p, P>
Source§impl<'p, P: Sqlite3Wal> Connection<'p, P>
impl<'p, P: Sqlite3Wal> Connection<'p, P>
Source§impl<'p, P: Sqlite3Metadata> Connection<'p, P>
impl<'p, P: Sqlite3Metadata> Connection<'p, P>
Sourcepub fn table_column_metadata(
&self,
db_name: Option<&str>,
table: &str,
column: &str,
) -> Result<ColumnMetadata>
pub fn table_column_metadata( &self, db_name: Option<&str>, table: &str, column: &str, ) -> Result<ColumnMetadata>
Fetch column metadata for a table.
Source§impl<'p, P: Sqlite3Api> Connection<'p, P>
impl<'p, P: Sqlite3Api> Connection<'p, P>
Sourcepub fn create_scalar_function<F>(
&self,
name: &str,
n_args: i32,
func: F,
) -> Result<()>
pub fn create_scalar_function<F>( &self, name: &str, n_args: i32, func: F, ) -> Result<()>
Register a scalar function (xFunc).
Sourcepub fn create_aggregate_function<T, Init, Step, Final>(
&self,
name: &str,
n_args: i32,
init: Init,
step: Step,
final_fn: Final,
) -> Result<()>
pub fn create_aggregate_function<T, Init, Step, Final>( &self, name: &str, n_args: i32, init: Init, step: Step, final_fn: Final, ) -> Result<()>
Register an aggregate function (xStep/xFinal).
Sourcepub fn create_window_function<T, Init, Step, Inverse, ValueFn, Final>(
&self,
name: &str,
n_args: i32,
init: Init,
step: Step,
inverse: Inverse,
value_fn: ValueFn,
final_fn: Final,
) -> Result<()>where
T: Send + 'static,
Init: Fn() -> T + Send + 'static,
Step: for<'a> FnMut(&Context<'a, P>, &mut T, &[ValueRef<'a>]) -> Result<()> + Send + 'static,
Inverse: for<'a> FnMut(&Context<'a, P>, &mut T, &[ValueRef<'a>]) -> Result<()> + Send + 'static,
ValueFn: for<'a> FnMut(&Context<'a, P>, &mut T) -> Result<Value> + Send + 'static,
Final: for<'a> FnMut(&Context<'a, P>, T) -> Result<Value> + Send + 'static,
pub fn create_window_function<T, Init, Step, Inverse, ValueFn, Final>(
&self,
name: &str,
n_args: i32,
init: Init,
step: Step,
inverse: Inverse,
value_fn: ValueFn,
final_fn: Final,
) -> Result<()>where
T: Send + 'static,
Init: Fn() -> T + Send + 'static,
Step: for<'a> FnMut(&Context<'a, P>, &mut T, &[ValueRef<'a>]) -> Result<()> + Send + 'static,
Inverse: for<'a> FnMut(&Context<'a, P>, &mut T, &[ValueRef<'a>]) -> Result<()> + Send + 'static,
ValueFn: for<'a> FnMut(&Context<'a, P>, &mut T) -> Result<Value> + Send + 'static,
Final: for<'a> FnMut(&Context<'a, P>, T) -> Result<Value> + Send + 'static,
Register a window function (xStep/xInverse/xValue/xFinal).
Source§impl<'p, P: Sqlite3Api> Connection<'p, P>
impl<'p, P: Sqlite3Api> Connection<'p, P>
Sourcepub fn create_module<T>(&self, name: &str) -> Result<()>
pub fn create_module<T>(&self, name: &str) -> Result<()>
Register a virtual table module using the default glue.
Trait Implementations§
Source§impl<'p, P: Sqlite3Api> Drop for Connection<'p, P>
impl<'p, P: Sqlite3Api> Drop for Connection<'p, P>
Auto Trait Implementations§
impl<'p, P> Freeze for Connection<'p, P>
impl<'p, P> RefUnwindSafe for Connection<'p, P>
impl<'p, P> !Send for Connection<'p, P>
impl<'p, P> !Sync for Connection<'p, P>
impl<'p, P> Unpin for Connection<'p, P>
impl<'p, P> UnsafeUnpin for Connection<'p, P>
impl<'p, P> UnwindSafe for Connection<'p, P>
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