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.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
customStatement(
String sql, [List? args, Iterable< TableUpdate> updates = const Iterable.empty()]) → void -
Executes the custom
sql
statement with variables instantiated toargs
. -
delete<
T extends Table, D> (TableInfo< T, D> table, Insertable<D> row) → void -
Deletes
row
from thetable
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 providedfilter
. -
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< rows, {InsertMode? mode, UpsertClause<D> >T, D> ? onConflict}) → void -
Inserts all
rows
into thetable
. -
insertAllOnConflictUpdate<
T extends Table, D> (TableInfo< T, D> table, Iterable<Insertable< rows) → voidD> > - 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 thetable
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< rows) → voidD> > -
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 thetable
that match thewhere
clause.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited