pub struct UpdateQuery {
pub with: With,
pub or: Option<Or>,
pub table: TableRef,
pub set: Set,
pub from: TableRef,
pub extra_from: Vec<TableRef>,
pub where_: Where,
pub returning: Returning,
}Expand description
A SQLite UPDATE.
From https://www.sqlite.org/lang_update.html:
[ WITH [ RECURSIVE ] common-table-expression [, ...] ]
UPDATE [ OR { ROLLBACK | ABORT | REPLACE | FAIL | IGNORE } ] qualified-table-name
SET { column | ( column [, ...] ) } = expr [, ...]
[ FROM table-or-subquery [, ...] | join-clause ]
[ WHERE expr ]
[ RETURNING result-column [, ...] ]UPDATE … FROM needs SQLite 3.33 or later and RETURNING needs 3.35.
The target is a qualified-table-name, so it takes INDEXED BY/NOT INDEXED
but not a column-alias list — the alias list SQLite allows there is only
AS alias. The FROM items are table-or-subquerys and the joins attach to
those, never to the target, which is the whole reason
table and from are different
mods.
The assignment list is not optional: UPDATE t with no SET is not a
statement, so an empty Set is a recorded Error::Incomplete.
There is no ORDER BY or LIMIT here. SQLite’s parser accepts them, but only a
build compiled with SQLITE_ENABLE_UPDATE_DELETE_LIMIT does, and the ordinary
one refuses them.
Fields§
§with: WithWITH ….
or: Option<Or>OR REPLACE and friends. None is the default, ABORT.
table: TableRefThe table being updated.
set: SetSET ….
from: TableRefThe first FROM item, with its joins.
extra_from: Vec<TableRef>Further comma-separated FROM items.
where_: WhereWHERE ….
returning: ReturningRETURNING ….
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 HasJoins for UpdateQuery
impl HasJoins for UpdateQuery
Source§impl HasOr for UpdateQuery
impl HasOr for UpdateQuery
Source§impl HasReturning for UpdateQuery
impl HasReturning for UpdateQuery
Source§fn returning_mut(&mut self) -> &mut Returning
fn returning_mut(&mut self) -> &mut Returning
RETURNING clause to modify.