Skip to main content

DeleteStatement

Struct DeleteStatement 

Source
pub struct DeleteStatement {
    pub ctes: Vec<Cte>,
    pub table: String,
    pub only: bool,
    pub alias: Option<String>,
    pub where_: Option<Expr>,
    pub order_limit: Option<Box<DmlOrderLimit>>,
    pub returning: Option<Vec<SelectItem>>,
}
Expand description

DELETE FROM <table> [WHERE cond]. v4.4 — removes matched rows from the active catalog and prunes them from every index.

Fields§

§ctes: Vec<Cte>

v7.37.43-T4.4 — leading WITH cte AS (…) clauses on a top- level DELETE. Empty for a plain DELETE.

§table: String§only: bool

v7.39 (round 646) — DELETE FROM ONLY t, the sibling of UpdateStatement::only: apply to t’s own rows and not to anything that descends from it.

Round 644 taught the FROM clause the keyword and left DML behind because it needed a field here, and this struct carries a warning that round 413 measured widening it in place overflowing the parser’s nesting stack. That warning was about from_sources, a struct wide enough to need boxing; a bool lands in the padding already present — same as CreateTableStatement::temporary.

It also earns its keep beyond the spelling: the inheritance fan-out needs a way to say “the parent’s own rows” as a statement, or running one on the parent recurses forever.

§alias: Option<String>

v7.39 (round 241) — DELETE FROM t [AS] alias USING …: the name the WHERE / RETURNING expressions refer to the target row by.

§where_: Option<Expr>§order_limit: Option<Box<DmlOrderLimit>>

v7.39 (round 432) — MySQL’s DELETE … [ORDER BY … [LIMIT n]], the batched-cleanup idiom. Same clause and same meaning as the UPDATE form (round 413), so it shares that payload — and it is boxed for the same reason: a naked Vec<OrderBy> + Option<u32> on a DML statement tipped the parser’s 512 KiB nesting stack.

§returning: Option<Vec<SelectItem>>

v7.9.4 — RETURNING <projection>.

Trait Implementations§

Source§

impl Clone for DeleteStatement

Source§

fn clone(&self) -> DeleteStatement

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 DeleteStatement

Source§

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

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

impl Display for DeleteStatement

Source§

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

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

impl PartialEq for DeleteStatement

Source§

fn eq(&self, other: &DeleteStatement) -> 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 DeleteStatement

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.