pub struct PendingResult<'a> { /* private fields */ }Expand description
Incremental execution of a prepared statement, one task at a time. A pending (incrementally-executed) query, borrowing the statement it runs.
Owns the duckdb_pending_result handle and destroys it in Drop. Borrows
the CachedStatement for 'a so the statement (and, through it, the
connection) cannot be destroyed while the pending execution references it.
Implementations§
Source§impl<'a> PendingResult<'a>
impl<'a> PendingResult<'a>
Sourcepub fn execute_task(&mut self) -> PendingState
pub fn execute_task(&mut self) -> PendingState
Executes a single task, returning the resulting PendingState.
Call repeatedly while the state is NotReady or
NoTasksAvailable; stop on
Ready (then call execute)
or Error.
Sourcepub fn check_state(&mut self) -> PendingState
pub fn check_state(&mut self) -> PendingState
Returns the current PendingState without executing a task.
Sourcepub fn error(&self) -> Option<String>
pub fn error(&self) -> Option<String>
Returns DuckDB’s current error message for this pending result, if any.
Sourcepub fn execute(self) -> Result<DuckResult>
pub fn execute(self) -> Result<DuckResult>
Runs the pending execution to completion and returns the materialised
DuckResult, consuming self so the result is transferred exactly once.
This drives any remaining tasks internally; call it directly for the simple
case, or step with execute_task first when
you need to interleave cancellation checks.
§Errors
Returns Error::Engine carrying DuckDB’s classification/message if
execution fails.