Batch class

Contains operations to run queries in a batched mode.

Inside a batch, a set of SQL statements is collected and then run at once. Conceptually, batches are similar to a transaction (and they will use transactions internally). Additionally, batches are very efficient when the same SQL statement is executed with different parameters. Outside of a batch, a new statement would be parsed and prepared for each execution. With batches, statements are only prepared once and then run with the parameters needed.

This makes batches particularly suitable for bulk updates.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

customStatement(String sql, [List? args, Iterable<TableUpdate> updates = const Iterable.empty()]) → void
Executes the custom sql statement with variables instantiated to args.
delete<T extends Table, D>(TableInfo<T, D> table, Insertable<D> row) → void
Deletes row from the table when this batch is executed.
deleteAll<T extends Table, D>(TableInfo<T, D> table) → void
Deletes ALL rows from table.
deleteWhere<T extends Table, D>(TableInfo<T, D> table, Expression<bool> filter(T tbl)) → void
Deletes all rows from table matching the provided filter.
insert<T extends Table, D>(TableInfo<T, D> table, Insertable<D> row, {InsertMode? mode, UpsertClause<T, D>? onConflict}) → void
Inserts a row constructed from the fields in row.
insertAll<T extends Table, D>(TableInfo<T, D> table, Iterable<Insertable<D>> rows, {InsertMode? mode, UpsertClause<T, D>? onConflict}) → void
Inserts all rows into the table.
insertAllOnConflictUpdate<T extends Table, D>(TableInfo<T, D> table, Iterable<Insertable<D>> rows) → void
Equivalent of InsertStatement.insertOnConflictUpdate for multiple rows that will be inserted in this batch.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replace<T extends Table, D>(TableInfo<T, D> table, Insertable<D> row) → void
Replaces the row from the table with the updated values. The row in the table with the same primary key will be replaced.
replaceAll<T extends Table, D>(TableInfo<T, D> table, Iterable<Insertable<D>> rows) → void
Helper that calls replace for all rows.
toString() String
A string representation of this object.
inherited
update<T extends Table, D>(TableInfo<T, D> table, Insertable<D> row, {Expression<bool> where(T table)?}) → void
Writes all present columns from the row into all rows in the table that match the where clause.

Operators

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