Skip to main content

BoundSelect

Struct BoundSelect 

Source
pub struct BoundSelect {
Show 14 fields pub sources: Vec<BoundSource>, pub filter: Option<BoundExpr>, pub group_by: Vec<BoundExpr>, pub having: Option<BoundExpr>, pub columns: Vec<BoundResultColumn>, pub distinct: bool, pub order_by: Vec<BoundOrderTerm>, pub limit: Option<BoundExpr>, pub offset: Option<BoundExpr>, pub aggregates: Vec<BoundAggregate>, pub values: Vec<Vec<BoundExpr>>, pub compounds: Vec<(CompoundOp, BoundSelect)>, pub windows: Vec<BoundWindow>, pub correlations: Vec<usize>,
}
Expand description

A bound SELECT.

Fields§

§sources: Vec<BoundSource>

The FROM terms, in written order.

§filter: Option<BoundExpr>

The WHERE clause.

§group_by: Vec<BoundExpr>

The GROUP BY terms.

§having: Option<BoundExpr>

The HAVING clause.

§columns: Vec<BoundResultColumn>

The result columns, after star expansion.

§distinct: bool

Whether DISTINCT was written.

§order_by: Vec<BoundOrderTerm>

The ORDER BY terms.

§limit: Option<BoundExpr>

The LIMIT expression.

§offset: Option<BoundExpr>

The OFFSET expression.

§aggregates: Vec<BoundAggregate>

The aggregates the statement computes.

§values: Vec<Vec<BoundExpr>>

The rows of a VALUES arm, when the statement is one.

§compounds: Vec<(CompoundOp, BoundSelect)>

The later arms of a compound, each with the operator that joined it.

When this is not empty, the order_by, limit and offset on this block belong to the compound as a whole rather than to the first arm - which is exactly SQLite’s rule, since an arm of a compound may not carry its own. distinct stays the first arm’s own.

§windows: Vec<BoundWindow>

The window calls the block computes, in the order they were bound.

§correlations: Vec<usize>

The FROM terms belonging to an enclosing block that this one reads.

A block with an empty list is uncorrelated and can be evaluated once; a block with a non-empty one has to be re-evaluated for each row of the outermost term it names. The compiler needs no more than that, because the outer cursors are still open and positioned when the child runs.

Implementations§

Source§

impl BoundSelect

Source

pub fn columns_read(&self, source: usize) -> ColumnUse

Returns which of one FROM term’s columns this block reads.

Every expression the block holds is visited, because the question this answers is whether an index carries everything the query needs from a table - and a single missed expression would be a column read from an index that does not hold it. The walk is therefore written to be obviously complete rather than briefly: every field of the block that can hold an expression is named here, and BoundExpr::children is exhaustive so a new expression variant is a compilation error rather than an unvisited subtree.

Anything it cannot enumerate marks the answer opaque, and an opaque answer is never coverable. A nested block that correlates to this term is the case that matters: it is a query of its own and could read any column of the term it correlates to. @param source - the statement-wide number of the FROM term

Source

pub fn is_aggregate(&self) -> bool

Returns whether the statement aggregates its input into one group or into groups.

Trait Implementations§

Source§

impl Clone for BoundSelect

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BoundSelect

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BoundSelect

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BoundSelect

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.