Skip to main content

SelectStatement

Struct SelectStatement 

Source
pub struct SelectStatement {
    pub ctes: Vec<Cte>,
    pub distinct: bool,
    pub items: Vec<SelectItem>,
    pub from: Option<FromClause>,
    pub where_: Option<Expr>,
    pub group_by: Option<Vec<Expr>>,
    pub group_by_all: bool,
    pub having: Option<Expr>,
    pub unions: Vec<(UnionKind, SelectStatement)>,
    pub order_by: Vec<OrderBy>,
    pub limit: Option<LimitExpr>,
    pub offset: Option<LimitExpr>,
}

Fields§

§ctes: Vec<Cte>

v4.11: WITH name AS (SELECT ...) [, ...] common-table expressions, materialised once at query start before the body SELECT runs. Empty for a regular SELECT. Non-recursive only — no WITH RECURSIVE for v4.x.

§distinct: bool§items: Vec<SelectItem>§from: Option<FromClause>§where_: Option<Expr>§group_by: Option<Vec<Expr>>§group_by_all: bool

v6.4.1 — GROUP BY ALL shortcut: when true, the planner expands group_by to every non-aggregate SELECT-list item before the executor runs. Mutually exclusive with an explicit group_by list (the parser sets exactly one).

§having: Option<Expr>

HAVING <expr> — filter applied after GROUP BY aggregation. Supports aggregate calls (e.g. HAVING count(*) > 1); the aggregate executor resolves them through the same synthetic schema used for the SELECT items.

§unions: Vec<(UnionKind, SelectStatement)>

UNION / UNION ALL chain. Empty for a plain SELECT. Each peer is itself a SelectStatement with order_by = None and limit = None (the parser enforces that — ORDER BY / LIMIT belong to the top of the chain).

§order_by: Vec<OrderBy>

v6.4.0 — multi-key ORDER BY. Empty Vec means no ORDER BY. Keys are matched left-to-right: first key decides, ties break to the second, etc.

§limit: Option<LimitExpr>

LIMIT <n> — bound on row output. n is an integer literal or (v7.9.24) a placeholder $N resolved against the prepared-statement Bind values. mailrs migration follow-up H2.

§offset: Option<LimitExpr>

OFFSET <n> — drop the first n rows after ORDER BY but before LIMIT (so LIMIT 10 OFFSET 5 keeps rows 6..=15).

Implementations§

Source§

impl SelectStatement

v7.9.24 — extract LIMIT / OFFSET as a u32 literal. After the engine’s substitute_placeholders pass these are always Literal; in the simple-query path a Placeholder shape returns None (executor surfaces as “LIMIT/OFFSET ${n} requires prepared-statement binding”).

Source

pub fn limit_literal(&self) -> Option<u32>

Source

pub fn offset_literal(&self) -> Option<u32>

Trait Implementations§

Source§

impl Clone for SelectStatement

Source§

fn clone(&self) -> SelectStatement

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 SelectStatement

Source§

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

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

impl Display for SelectStatement

Source§

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

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

impl PartialEq for SelectStatement

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SelectStatement

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.