Skip to main content

InsertSelect

Struct InsertSelect 

Source
pub struct InsertSelect<D, T> { /* private fields */ }
Expand description

INSERT INTO t (..) SELECT ..: rows a query produces rather than rows a caller holds. From InsertSeed::select.

The header is the target’s own writable columns, so the two sides line up by the target’s order rather than by whatever order its CREATE TABLE happened to use. The body is a render::Fragment, rendered before the statement knows how many parameters precede it, for the reason a CTE body is one.

Known limitation: no ON CONFLICT on this shape, and no column subset. The query fills every column the target lets one write.

Trait Implementations§

Source§

impl<D: Dialect, T: Table> Statement for InsertSelect<D, T>

Source§

type Dialect = D

Source§

type Table = T

Source§

fn to_sql(&self, _dialect: Self::Dialect) -> (String, Vec<Value>)

The dialect is an argument for the reason Select::to_sql’s is.
Source§

fn returning<Sel, Idx>(self, sel: Sel) -> Returning<Self, Sel>
where Self: Sized, Self::Dialect: SupportsReturning, Sel: Selection<WrittenTable<Self::Table>, Idx>,

RETURNING, on whichever of the three this is. The clause is the same clause. A distinct type rather than Self with a flag set: the execution layer needs Sel’s concrete type to know what to decode a returned row into, and an optional field would erase it. Read more

Auto Trait Implementations§

§

impl<D, T> Freeze for InsertSelect<D, T>
where PhantomData<fn() -> (D, T)>: Freeze,

§

impl<D, T> RefUnwindSafe for InsertSelect<D, T>

§

impl<D, T> Send for InsertSelect<D, T>
where PhantomData<fn() -> (D, T)>: Send,

§

impl<D, T> Sync for InsertSelect<D, T>
where PhantomData<fn() -> (D, T)>: Sync,

§

impl<D, T> Unpin for InsertSelect<D, T>
where PhantomData<fn() -> (D, T)>: Unpin,

§

impl<D, T> UnsafeUnpin for InsertSelect<D, T>

§

impl<D, T> UnwindSafe for InsertSelect<D, T>

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> 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<S> Superset<Nil, Nil> for S

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.
Source§

impl<T> WrapNullable<NotNull> for T