pub struct SelectStatement {
pub select_clause: SelectClause,
pub from_clause: Option<FromClause>,
pub where_clause: Option<WhereExpression>,
pub group_by: Option<GroupByClause>,
pub having_clause: Option<WhereExpression>,
pub order_by: Option<OrderByClause>,
pub limit: Option<LimitClause>,
pub per_partition_limit: Option<u64>,
pub offset: Option<u64>,
pub allow_filtering: bool,
}Expand description
Complete SELECT statement AST
Fields§
§select_clause: SelectClauseSELECT clause - what to return
from_clause: Option<FromClause>FROM clause - which table(s) to query (optional for constant expressions)
where_clause: Option<WhereExpression>WHERE clause - filtering conditions
group_by: Option<GroupByClause>GROUP BY clause - grouping columns
having_clause: Option<WhereExpression>HAVING clause - filtering after grouping
order_by: Option<OrderByClause>ORDER BY clause - sorting specification
limit: Option<LimitClause>LIMIT clause - query-wide result size limitation
per_partition_limit: Option<u64>PER PARTITION LIMIT - cap on rows returned per partition, applied
before the query-wide limit (Cassandra semantics, Issue #757)
offset: Option<u64>OFFSET clause - result pagination
allow_filtering: boolAllow filtering flag (for non-indexed queries)
Implementations§
Source§impl SelectStatement
impl SelectStatement
Sourcepub fn select_all_from(table: TableId) -> Self
pub fn select_all_from(table: TableId) -> Self
Create a simple SELECT * FROM table statement
Sourcepub fn requires_aggregation(&self) -> bool
pub fn requires_aggregation(&self) -> bool
Check if this query requires aggregation
Sourcepub fn has_aggregate_functions(&self) -> bool
pub fn has_aggregate_functions(&self) -> bool
Check if this query has aggregate functions
Sourcepub fn bind_marker_count(&self) -> usize
pub fn bind_marker_count(&self) -> usize
Count the positional ? bind markers in this statement.
Issue #961: the marker indices are assigned left-to-right by the parser,
so the highest index plus one equals the required parameter count. Used by
execute_with_params / prepared execution to enforce a strict arity check
before binding.
Sourcepub fn bind_parameters(&mut self, params: &[Value]) -> Result<()>
pub fn bind_parameters(&mut self, params: &[Value]) -> Result<()>
Substitute positional ? bind markers with params, in place.
Issue #961: each SelectExpression::BindMarker(i) is rewritten to
SelectExpression::Literal(params[i].clone()). The supplied parameter
count must exactly equal bind_marker_count(); too few or too many is a
hard error (strict CQL arity). Binding happens before optimization, so
the bound literals participate in partition-key classification, encoding,
and typed coercion exactly as if they had been written inline.
Sourcepub fn get_referenced_columns(&self) -> Vec<ColumnRef>
pub fn get_referenced_columns(&self) -> Vec<ColumnRef>
Get all referenced columns (for query planning).
SELECT * contributes nothing here; the projection is resolved later
against the schema during planning.
Trait Implementations§
Source§impl Clone for SelectStatement
impl Clone for SelectStatement
Source§fn clone(&self) -> SelectStatement
fn clone(&self) -> SelectStatement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more