pub struct SelectStatement {Show 21 fields
pub distinct: bool,
pub columns: Vec<String>,
pub select_items: Vec<SelectItem>,
pub from_source: Option<TableSource>,
pub from_table: Option<String>,
pub from_subquery: Option<Box<SelectStatement>>,
pub from_function: Option<TableFunction>,
pub from_alias: Option<String>,
pub joins: Vec<JoinClause>,
pub where_clause: Option<WhereClause>,
pub order_by: Option<Vec<OrderByItem>>,
pub group_by: Option<Vec<SqlExpression>>,
pub having: Option<SqlExpression>,
pub qualify: Option<SqlExpression>,
pub limit: Option<usize>,
pub offset: Option<usize>,
pub ctes: Vec<CTE>,
pub into_table: Option<IntoTable>,
pub set_operations: Vec<(SetOperation, Box<SelectStatement>)>,
pub leading_comments: Vec<Comment>,
pub trailing_comment: Option<Comment>,
}Fields§
§distinct: bool§columns: Vec<String>§select_items: Vec<SelectItem>§from_source: Option<TableSource>§from_table: Option<String>Use from_source instead
from_subquery: Option<Box<SelectStatement>>Use from_source instead
from_function: Option<TableFunction>Use from_source instead
from_alias: Option<String>Use from_source instead
joins: Vec<JoinClause>§where_clause: Option<WhereClause>§order_by: Option<Vec<OrderByItem>>§group_by: Option<Vec<SqlExpression>>§having: Option<SqlExpression>§qualify: Option<SqlExpression>§limit: Option<usize>§offset: Option<usize>§ctes: Vec<CTE>§into_table: Option<IntoTable>§set_operations: Vec<(SetOperation, Box<SelectStatement>)>§leading_comments: Vec<Comment>§trailing_comment: Option<Comment>Implementations§
Source§impl SelectStatement
impl SelectStatement
Sourcepub fn set_from_table(&mut self, table: String)
pub fn set_from_table(&mut self, table: String)
Point the FROM clause at a named table, updating from_source and the
legacy fields together.
Both representations must move in lockstep: the executor
(query_engine.rs) reads from_source first and only falls back to
from_table, so a rewrite that touches just the legacy field is
silently discarded whenever from_source is populated.
Sourcepub fn set_from_subquery(&mut self, query: Box<SelectStatement>)
pub fn set_from_subquery(&mut self, query: Box<SelectStatement>)
Replace the derived table (subquery) in the FROM clause, updating
from_source and the legacy field together.
The parser populates from_subquery and from_source::DerivedTable
with clones of the same subquery, so rewriting only the former leaves a
stale copy in from_source — which is the one the executor reads. The
existing derived-table alias is preserved.
Sourcepub fn map_from_subquery(
&mut self,
f: impl FnOnce(SelectStatement) -> SelectStatement,
)
pub fn map_from_subquery( &mut self, f: impl FnOnce(SelectStatement) -> SelectStatement, )
Rewrite the derived table (subquery) in the FROM clause in place, if
there is one, keeping from_source and the legacy field in sync.
Prefer this over taking from_subquery and reassigning it: the
take-then-restore pattern leaves the from_source copy stale in
between, and the alias is easy to drop on the way through.
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 moreSource§impl Debug for SelectStatement
impl Debug for SelectStatement
Auto Trait Implementations§
impl Freeze for SelectStatement
impl RefUnwindSafe for SelectStatement
impl Send for SelectStatement
impl Sync for SelectStatement
impl Unpin for SelectStatement
impl UnsafeUnpin for SelectStatement
impl UnwindSafe for SelectStatement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more