Skip to main content

TableChain

Struct TableChain 

Source
pub struct TableChain<S> { /* private fields */ }
Expand description

A table-or-subquery — or a qualified-table-name — under construction.

[ schema. ] table-name [ AS alias ] [ INDEXED BY index-name | NOT INDEXED ]
[ schema. ] table-function ( expr [, ...] ) [ AS alias ]
( select-stmt ) [ AS alias ]

That is the whole list of decorations SQLite allows on a from-item, and it is shorter than PostgreSQL’s by everything: no ONLY, no LATERAL, no WITH ORDINALITY, no TABLESAMPLE, and no column-alias listt (a, b) is PostgreSQL’s, and SQLite has only AS alias. A table-valued function needs no mod of its own either, because a call is already an expression: from(f("pragma_table_info", s("users"))).

Implementations§

Source§

impl<S> TableChain<S>

Source

pub fn as_(self, alias: impl Into<Cow<'static, str>>) -> TableChain<S>

AS "alias".

Source

pub fn indexed_by(self, name: impl Into<Cow<'static, str>>) -> TableChain<S>

INDEXED BY "name" — refuse to plan this item any other way.

A tuning hint that SQLite treats as a hard constraint: it is an error if the named index cannot be used. Applies to a table name, not to a sub-query or a table-valued function.

Source

pub fn not_indexed(self) -> TableChain<S>

NOT INDEXED — plan this item without any index the planner would otherwise have chosen.

Source§

impl TableChain<ExtraSlot>

Source

pub fn join(self, join: impl Into<Join>) -> TableChain<ExtraSlot>

A join written after this comma-separated item rather than after the leading one: FROM "a", "b" INNER JOIN "c" ON ….

Grammatical because the comma is one of SQLite’s join operators: parse.y reads the whole FROM as one chain — seltablist ::= stl_prefix nm …, stl_prefix ::= seltablist joinop, and joinop ::= COMMA|JOIN — so a JOIN may follow a comma item. One honest caveat, and it is SQLite’s, not this method’s: the operators are processed left to right with no precedence, so the join’s left operand is everything before it in the list, not this item alone — unlike PostgreSQL and MySQL, where the join binds tighter than the comma. Takes the same JoinChain the standalone join mods are — those reach the leading item through HasJoins, which is why the extra items take theirs by method instead. Several calls chain several joins.

Trait Implementations§

Source§

impl<S: Clone> Clone for TableChain<S>

Source§

fn clone(&self) -> TableChain<S>

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<S: Debug> Debug for TableChain<S>

Source§

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

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

impl<Q, S: TableSlot<Q>> Mod<Q> for TableChain<S>

Source§

fn apply(self, q: &mut Q)

Apply this modification to q.

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for TableChain<S>

§

impl<S> !UnwindSafe for TableChain<S>

§

impl<S> Freeze for TableChain<S>

§

impl<S> Send for TableChain<S>
where S: Send,

§

impl<S> Sync for TableChain<S>
where S: Sync,

§

impl<S> Unpin for TableChain<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for TableChain<S>

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 = 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.