pub struct NativeDatabaseHandle { /* private fields */ }Implementations§
Source§impl NativeDatabaseHandle
impl NativeDatabaseHandle
pub fn new(vfs: NativeVfsHandle, file_name: String) -> Result<Self>
Sourcepub fn new_with_metrics(
vfs: NativeVfsHandle,
file_name: String,
metrics: Option<Arc<dyn SqliteVfsMetrics>>,
) -> Result<Self>
pub fn new_with_metrics( vfs: NativeVfsHandle, file_name: String, metrics: Option<Arc<dyn SqliteVfsMetrics>>, ) -> Result<Self>
Runs the database on a dedicated single-thread pool.
Sourcepub fn new_on_pool(
pool: &SqlitePool,
vfs: NativeVfsHandle,
file_name: String,
metrics: Option<Arc<dyn SqliteVfsMetrics>>,
) -> Result<Self>
pub fn new_on_pool( pool: &SqlitePool, vfs: NativeVfsHandle, file_name: String, metrics: Option<Arc<dyn SqliteVfsMetrics>>, ) -> Result<Self>
Runs the database on a shared worker pool.
pub async fn exec(&self, sql: String) -> Result<QueryResult>
pub async fn exec_profiled( &self, sql: String, ) -> Result<SqliteWorkerResult<QueryResult>>
Sourcepub async fn cork_commits(&self) -> Result<()>
pub async fn cork_commits(&self) -> Result<()>
Holds every later commit in memory until uncork_commits sends them to depot as one
commit. None of the held transactions is durable until uncorking succeeds.
Sourcepub async fn uncork_commits(&self) -> Result<()>
pub async fn uncork_commits(&self) -> Result<()>
Sends the transactions committed since cork_commits to depot as one commit. Inside an
explicit transaction it waits until the transaction ends, so the commit includes it.
pub async fn query( &self, sql: String, params: Option<Vec<BindParam>>, ) -> Result<QueryResult>
pub async fn run( &self, sql: String, params: Option<Vec<BindParam>>, ) -> Result<ExecResult>
pub async fn execute( &self, sql: String, params: Option<Vec<BindParam>>, ) -> Result<ExecuteResult>
pub async fn execute_profiled( &self, sql: String, params: Option<Vec<BindParam>>, ) -> Result<SqliteWorkerResult<ExecuteResult>>
Sourcepub fn set_background(&self, background: bool)
pub fn set_background(&self, background: bool)
Marks this database’s later work as background work; see
SqliteWorkerHandle::set_background.
Sourcepub async fn execute_batch(
&self,
statements: Vec<(String, Option<Vec<BindParam>>)>,
) -> Result<Vec<ExecuteResult>>
pub async fn execute_batch( &self, statements: Vec<(String, Option<Vec<BindParam>>)>, ) -> Result<Vec<ExecuteResult>>
Runs statements in order as one worker command; see
SqliteWorkerHandle::execute_batch.
pub async fn close(&self) -> Result<()>
Sourcepub async fn close_and_wait(&self) -> Result<()>
pub async fn close_and_wait(&self) -> Result<()>
Closes the database without returning while its worker still owns SQLite. Any returned error is reported only after the worker thread has terminated.
pub async fn wait_for_worker_failure(&self) -> bool
Sourcepub fn explicit_transaction_open(&self) -> bool
pub fn explicit_transaction_open(&self) -> bool
Returns whether the connection has an open explicit transaction, such as
one started by a manual BEGIN, as of the last completed command.
Sourcepub fn subscribe_explicit_transaction(&self) -> Receiver<bool>
pub fn subscribe_explicit_transaction(&self) -> Receiver<bool>
Subscribes to explicit transaction state changes. The value changes before the reply of the command that changed it is delivered.
pub fn take_last_kv_error(&self) -> Option<String>
pub fn clone_fatal_error(&self) -> Option<String>
Sourcepub fn read_vfs_file(&self, path: &str) -> Option<Vec<u8>>
pub fn read_vfs_file(&self, path: &str) -> Option<Vec<u8>>
Reads back a file the connection wrote through its own VFS, such as a VACUUM INTO output.
Sourcepub fn delete_vfs_file(&self, path: &str)
pub fn delete_vfs_file(&self, path: &str)
Drops a file the connection wrote through its own VFS, releasing the memory holding it.