pub struct PreparedQuery {
pub cql: String,
pub parsed_query: ParsedQuery,
pub plan: QueryPlan,
pub parameters: Vec<ParameterMetadata>,
/* private fields */
}Expand description
Prepared query statement
Fields§
§cql: StringOriginal CQL text
parsed_query: ParsedQueryParsed query
plan: QueryPlanQuery execution plan
parameters: Vec<ParameterMetadata>Parameter metadata
Implementations§
Source§impl PreparedQuery
impl PreparedQuery
Sourcepub fn new(
parsed_query: ParsedQuery,
plan: QueryPlan,
executor: Arc<QueryExecutor>,
) -> Self
pub fn new( parsed_query: ParsedQuery, plan: QueryPlan, executor: Arc<QueryExecutor>, ) -> Self
Create a new prepared query (legacy / non-SELECT path).
Sourcepub async fn execute(&self, params: &[Value]) -> Result<QueryResult>
pub async fn execute(&self, params: &[Value]) -> Result<QueryResult>
Execute the prepared query with positional parameters.
Issue #961: for prepared SELECTs the parameters are bound into the parsed
statement and the bound query runs through the SELECT optimizer + executor,
so a prepared WHERE pk = ? engages the partition-targeted fast path.
Non-SELECT prepared statements retain the legacy executor path.
Sourcepub async fn execute_named(
&self,
params: &HashMap<String, Value>,
) -> Result<QueryResult>
pub async fn execute_named( &self, params: &HashMap<String, Value>, ) -> Result<QueryResult>
Execute with named parameters
Sourcepub async fn execute_with_context(
&self,
context: &PreparedContext,
) -> Result<QueryResult>
pub async fn execute_with_context( &self, context: &PreparedContext, ) -> Result<QueryResult>
Execute with execution context.
Issue #961 (Finding 2): when this prepared statement is a SELECT it owns a
[PreparedSelect] pipeline, and the context’s positional_params must be
bound and run through the same SELECT optimizer + executor as
Self::execute. Previously this method ignored the pipeline and ran the
legacy QueryExecutor plan with the parameters silently dropped, so a
prepared WHERE pk = ? executed through the context API never bound its
params and never engaged the partition-targeted fast path — inconsistent
with execute.
The legacy ExecutionHints (force_index, timeout_ms, parallelism)
are properties of the legacy QueryPlan and have no representation in the
SELECT pipeline. Rather than silently ignore a caller-supplied hint, a
SELECT prepared statement that is handed any hint returns a clear error.
SELECTs with no hints bind their params and run through the pipeline,
matching execute(context.positional_params).
Sourcepub fn parameters(&self) -> &[ParameterMetadata]
pub fn parameters(&self) -> &[ParameterMetadata]
Get parameter metadata
Sourcepub fn stats(&self) -> PreparedQueryStats
pub fn stats(&self) -> PreparedQueryStats
Get query statistics
Sourcepub fn is_cache_friendly(&self) -> bool
pub fn is_cache_friendly(&self) -> bool
Check if query is cache-friendly