MssqlWriteEngine<TRow> class
The one place insert, update, delete and upsert are executed.
Every write path funnels through here so three questions have one answer each rather than one per call site: which readback SQL the target table accepts, how many of the caller's rows actually changed, and what happens to a write whose guard fails.
Immutable and cheap: withSession makes the transaction-scoped copy a guard needs, so nothing here holds mutable state between calls.
- Annotations
-
- @immutable
Constructors
-
MssqlWriteEngine(MssqlSession session, {required MssqlTableBinding<
TRow> binding, required MssqlDialect dialect, MssqlTriggerKind? triggers, MssqlWriteReadback? readback, MssqlChangeHub? changes})
Properties
-
binding
→ MssqlTableBinding<
TRow> -
final
- changes → MssqlChangeHub?
-
final
- dialect → MssqlDialect
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- insertReadback → MssqlWriteReadback
-
Which readback an insert into this table will use.
no setter
- readback → MssqlWriteReadback?
-
The caller's declared strategy, overriding what the table implies.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → MssqlSession
-
final
- triggers → MssqlTriggerKind
-
What the target table carries, as generated code described it.
final
Methods
-
deleteWhere(
{required List< MssqlCondition> where, required String operation, bool allRows = false, List<MssqlCondition> scopes = const <MssqlCondition>[], bool readRows = false}) → Future<MssqlWriteOutcome> -
Removes every row matching
where. -
guard(
{required String operation, required int expected, required Future< MssqlWriteOutcome> write(MssqlWriteEngine<TRow> engine)}) → Future<MssqlWriteOutcome> -
Runs
writeand insists it affected exactlyexpectedrows. -
insertRow(
MssqlWriteAssignments values, {bool readRow = true}) → Future< MssqlWriteOutcome> - Inserts one row and reads back what the server stored.
-
insertSelect(
{required List< String> columns, required MssqlSelectQuery query, List<MssqlCte> ctes = const <MssqlCte>[]}) → Future<MssqlWriteOutcome> -
INSERT … SELECT, with the statement'sWITHclause where T-SQL wants it: at the very start, beforeINSERT. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateWhere(
{required MssqlWriteAssignments values, required List< MssqlCondition> where, required String operation, bool allRows = false, List<MssqlCondition> scopes = const <MssqlCondition>[], bool readRows = false}) → Future<MssqlWriteOutcome> -
Writes
valuesto every row matchingwhere. -
upsertRow(
{required MssqlWriteAssignments matching, required MssqlWriteAssignments insertValues, required MssqlWriteAssignments updateValues, bool readRow = true}) → Future< MssqlWriteOutcome> -
Updates the row
matchingidentifies or inserts it, then reads it back. -
withSession(
MssqlSession other) → MssqlWriteEngine< TRow> - The same engine against another session, which a guard needs when it has to open a transaction of its own.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited