pub struct ReaderGuard<'pool> { /* private fields */ }Expand description
A reader connection checked out from the pool. Returns the connection to the pool on drop.
Implementations§
Source§impl<'pool> ReaderGuard<'pool>
impl<'pool> ReaderGuard<'pool>
Sourcepub fn query_row<T, P, F>(
&self,
sql: &str,
params: P,
f: F,
) -> Result<T, SqliteError>
pub fn query_row<T, P, F>( &self, sql: &str, params: P, f: F, ) -> Result<T, SqliteError>
Run one read-only statement against this reader lease and map the
first resulting row, for callers outside khive-db.
Unlike a raw Connection, this never hands out a capability that can
change connection-local or database state: sql is checked against
the same allow-listed read-shape classifier
(SELECT/WITH ... SELECT/VALUES/EXPLAIN/a fixed read-only
PRAGMA set) the pooled SqlReader surface admits raw SQL through,
and anything else — BEGIN, DML, DDL, a setting PRAGMA, ATTACH
— is refused before it ever reaches SQLite. An admitted statement
still marks the checkout dirty unconditionally, so Drop always pays
the pristine-state scan (or, in degraded shared-lease mode, the
settings/rollback verification) on return.
SQL stepping cooperatively observes the current request’s cancellation and original absolute deadline. Synchronous mapper/native callback code cannot be forcibly preempted; a post-check refuses a successful result if the request stopped while that code ran.