pub struct PreparedQuery {
pub param_count: usize,
/* private fields */
}Expand description
Mission C Phase 5: a pre-parsed, pre-planned query. The caller holds
one of these and repeatedly executes it with fresh literal values via
Engine::execute_prepared. This is PowDB’s equivalent of SQLite’s
prepare_cached — the parse + plan cost is paid exactly once, and
every subsequent execution skips the lexer, the canonicalise hash,
and the plan-cache hashmap lookup.
The template plan still contains the literal values from the original
query string. They’re overwritten on every call. See execute_prepared
for the substitution walk order.
For PlanNode::Insert templates whose assignment values are all plain
literals (the common case — insert T { id := 1, name := "a" }), we
additionally resolve the column indices at prepare time and stash them
in insert_col_indices. That lets execute_prepared skip the
plan-clone + substitute walk entirely and build the row directly from
the caller’s literal slice — the fastest possible insert through the
query layer.
Fields§
§param_count: usizeTotal number of Expr::Literal slots reachable from the plan.
Callers must supply exactly this many literals per execution.
Trait Implementations§
Source§impl Clone for PreparedQuery
impl Clone for PreparedQuery
Source§fn clone(&self) -> PreparedQuery
fn clone(&self) -> PreparedQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more