pub struct DeleteQuery {
pub with: With,
pub hints: Hints,
pub modifiers: Modifiers,
pub tables: Vec<TableRef>,
pub partitions: Vec<Cow<'static, str>>,
pub using: TableRef,
pub extra_using: Vec<TableRef>,
pub where_: Where,
pub order_by: OrderBy,
pub limit: Limit,
}Expand description
A MySQL DELETE.
From https://dev.mysql.com/doc/refman/8.4/en/delete.html, taking the
single-table form and the FROM … USING spelling of the multiple-table one:
[WITH [RECURSIVE] with_query [, ...]]
DELETE [hint_comment] [LOW_PRIORITY] [QUICK] [IGNORE]
FROM tbl_name[.*] [[AS] tbl_alias] [, tbl_name[.*]] ...
[PARTITION (partition_name [, partition_name] ...)]
[USING table_references]
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]MySQL spells the multiple-table delete two ways —
DELETE t1, t2 FROM refs and DELETE FROM t1, t2 USING refs. Only the second
is built here, because it is also the single-table form with the USING left
out, so one shape covers both and DELETE FROM t is what an empty USING
gives.
§PARTITION sits in an odd place
This is the one statement where MySQL writes PARTITION after the alias.
TableRef puts it before, which is right everywhere else, so
HasDeleteTables carries a partition slot of its own and the
delete::from(..).partition(..) chain moves its list into it.
ORDER BY and LIMIT, like in UPDATE, are single-table only.
Fields§
§with: WithWITH ….
hints: Hints/*+ … */.
modifiers: ModifiersLOW_PRIORITY, QUICK and IGNORE.
tables: Vec<TableRef>The tables rows are deleted from — the FROM list.
partitions: Vec<Cow<'static, str>>PARTITION (…), written after the FROM list.
using: TableRefThe first USING item, with its joins.
extra_using: Vec<TableRef>Further comma-separated USING items.
where_: WhereWHERE ….
order_by: OrderByORDER BY …. Single-table form only.
limit: LimitLIMIT row_count. Single-table form only, and there is no OFFSET.
Implementations§
Source§impl DeleteQuery
impl DeleteQuery
Sourcepub fn new() -> DeleteQuery
pub fn new() -> DeleteQuery
A DELETE with nothing set yet.
Sourcepub fn apply(&mut self, mods: impl Mod<DeleteQuery>)
pub fn apply(&mut self, mods: impl Mod<DeleteQuery>)
Apply more mods to an existing query.
Trait Implementations§
Source§impl Clone for DeleteQuery
impl Clone for DeleteQuery
Source§fn clone(&self) -> DeleteQuery
fn clone(&self) -> DeleteQuery
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 DeleteQuery
impl Debug for DeleteQuery
Source§impl Default for DeleteQuery
impl Default for DeleteQuery
Source§fn default() -> DeleteQuery
fn default() -> DeleteQuery
Source§impl Expression for DeleteQuery
impl Expression for DeleteQuery
Source§impl HasDeleteTables for DeleteQuery
impl HasDeleteTables for DeleteQuery
Source§impl HasExtraTables for DeleteQuery
impl HasExtraTables for DeleteQuery
Source§fn extra_tables_mut(&mut self) -> &mut Vec<TableRef>
fn extra_tables_mut(&mut self) -> &mut Vec<TableRef>
Source§impl HasHints for DeleteQuery
impl HasHints for DeleteQuery
Source§impl HasJoins for DeleteQuery
impl HasJoins for DeleteQuery
Source§impl HasLimit for DeleteQuery
impl HasLimit for DeleteQuery
Source§impl HasModifiers for DeleteQuery
impl HasModifiers for DeleteQuery
Source§fn modifiers_mut(&mut self) -> &mut Modifiers
fn modifiers_mut(&mut self) -> &mut Modifiers
Source§impl HasOrderBy for DeleteQuery
impl HasOrderBy for DeleteQuery
Source§fn order_by_mut(&mut self) -> &mut OrderBy
fn order_by_mut(&mut self) -> &mut OrderBy
ORDER BY clause to modify.