pub struct UpdateQuery {
pub with: With,
pub hints: Hints,
pub modifiers: Modifiers,
pub table: TableRef,
pub extra_tables: Vec<TableRef>,
pub set: Set,
pub where_: Where,
pub order_by: OrderBy,
pub limit: Limit,
}Expand description
A MySQL UPDATE.
From https://dev.mysql.com/doc/refman/8.4/en/update.html, with the single-table and multiple-table forms folded together:
[WITH [RECURSIVE] with_query [, ...]]
UPDATE [hint_comment] [LOW_PRIORITY] [IGNORE] table_references
SET assignment_list
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]There is no UPDATE … FROM. MySQL’s target is a table_references, so a
join or a comma joins tables that are all updatable, and SET may assign to any
of them. That is the one structural difference from PostgreSQL, and it is why
this type implements HasTargetTable rather than
HasTableRef — update::inner_join(..)
lands on the updated table list, because there is nowhere else for it to go.
ORDER BY and LIMIT belong to the single-table form only; MySQL rejects them
once more than one table is named. Nothing here prevents it — the shape is
legal and the server is what says no.
Fields§
§with: WithWITH ….
hints: Hints/*+ … */.
modifiers: ModifiersLOW_PRIORITY and IGNORE.
table: TableRefThe first table reference, with its joins.
extra_tables: Vec<TableRef>Further comma-separated table references.
set: SetSET ….
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 UpdateQuery
impl UpdateQuery
Sourcepub fn new() -> UpdateQuery
pub fn new() -> UpdateQuery
An UPDATE with nothing set yet.
Sourcepub fn apply(&mut self, mods: impl Mod<UpdateQuery>)
pub fn apply(&mut self, mods: impl Mod<UpdateQuery>)
Apply more mods to an existing query.
Trait Implementations§
Source§impl Clone for UpdateQuery
impl Clone for UpdateQuery
Source§fn clone(&self) -> UpdateQuery
fn clone(&self) -> UpdateQuery
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 UpdateQuery
impl Debug for UpdateQuery
Source§impl Default for UpdateQuery
impl Default for UpdateQuery
Source§fn default() -> UpdateQuery
fn default() -> UpdateQuery
Source§impl Expression for UpdateQuery
impl Expression for UpdateQuery
Source§impl HasExtraTables for UpdateQuery
impl HasExtraTables for UpdateQuery
Source§fn extra_tables_mut(&mut self) -> &mut Vec<TableRef>
fn extra_tables_mut(&mut self) -> &mut Vec<TableRef>
Source§impl HasHints for UpdateQuery
impl HasHints for UpdateQuery
Source§impl HasJoins for UpdateQuery
impl HasJoins for UpdateQuery
Source§impl HasLimit for UpdateQuery
impl HasLimit for UpdateQuery
Source§impl HasModifiers for UpdateQuery
impl HasModifiers for UpdateQuery
Source§fn modifiers_mut(&mut self) -> &mut Modifiers
fn modifiers_mut(&mut self) -> &mut Modifiers
Source§impl HasOrderBy for UpdateQuery
impl HasOrderBy for UpdateQuery
Source§fn order_by_mut(&mut self) -> &mut OrderBy
fn order_by_mut(&mut self) -> &mut OrderBy
ORDER BY clause to modify.