pub struct ReplaceQuery {
pub hints: Hints,
pub modifiers: Modifiers,
pub table: TableRef,
pub values: Values,
pub set: Set,
}Expand description
A MySQL REPLACE.
From https://dev.mysql.com/doc/refman/8.4/en/replace.html:
REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name
[PARTITION (partition_name [, partition_name] ...)]
[(col_name [, col_name] ...)]
{ {VALUES | VALUE} (value_list) [, (value_list)] ...
| SET assignment_list
| [(col_name [, col_name] ...)] SELECT ... }A statement type of its own rather than a flag on
InsertQuery, because the differences are exactly the
things a flag would leave reachable: REPLACE has no HIGH_PRIORITY, no
IGNORE, no row alias and no ON DUPLICATE KEY UPDATE — the last two
being meaningless when a duplicate key is what the statement is for. Not
implementing the traits is how that is said, so replace::ignore() and
replace::on_duplicate_key_update(..) simply do not exist.
Its query_type is QueryType::Insert: REPLACE is a
DELETE-then-INSERT, and the layers above care only that it writes rows.
Fields§
§hints: Hints/*+ … */.
modifiers: ModifiersLOW_PRIORITY or DELAYED, and nothing else.
table: TableRefThe target: table, partitions, and the column list.
values: ValuesThe rows, or the query to insert the results of.
set: SetSET a = 1, b = 2, the assignment-list row source.
Implementations§
Source§impl ReplaceQuery
impl ReplaceQuery
Sourcepub fn new() -> ReplaceQuery
pub fn new() -> ReplaceQuery
A REPLACE with nothing set yet.
Sourcepub fn apply(&mut self, mods: impl Mod<ReplaceQuery>)
pub fn apply(&mut self, mods: impl Mod<ReplaceQuery>)
Apply more mods to an existing query.
Trait Implementations§
Source§impl Clone for ReplaceQuery
impl Clone for ReplaceQuery
Source§fn clone(&self) -> ReplaceQuery
fn clone(&self) -> ReplaceQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more