Mutation<F extends Fields> class final

A prepared insert, update, or delete that performs no I/O until executed.

compile inspects SQL; execute returns the affected-row count; returning prepares a typed result. Updates and deletes accept table filters, not joins, ordering, grouping, or pagination. Client defaults in a prepared insert are evaluated when it is built and reused if it executes again.

Relationship predicates remain subqueries within one statement. On MySQL, updates/deletes whose typed subqueries read the target table are rejected with CAPABILITY.MUTATION_SELF_REFERENCE before execution. Select keys in an explicit transaction, then mutate by those keys when that restriction applies.

Properties

database → QueryContext
Query context that owns this mutation's execution and transaction scope.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

compile() → SqlCommand
Validates and compiles SQL with separate parameters, without database I/O.
execute({ExecutionOptions options = const ExecutionOptions()}) → Future<int>
Executes the complete mutation and returns the driver's affected-row count.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onConflictDoNothing({List<ReadField<Object?>> target(F)?}) → Mutation<F>
Prepares SQLite/PostgreSQL duplicate-key suppression for this insert.
onConflictUpdate({required List<ReadField<Object?>> target(F), required List<Assignment> set(F existing, F incoming)}) → Mutation<F>
Prepares a SQLite/PostgreSQL upsert against a declared unique target.
onDuplicateKeyUpdate({required List<Assignment> set(F existing, F incoming)}) → Mutation<F>
MySQL/MariaDB update on any duplicate unique key, matching native semantics.
returning<R>(Selection<R> selection(F)) → Returning<R>
Prepares a typed RETURNING result on an engine that supports it.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited