Batch class final
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
- database → DatabaseConnectionUser
-
The database on which the batch will run when completed.
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
-
addStatement(
SqlStatement stmt) → BatchedStatement - Adds an SqlStatement to execute in this batch.
-
customStatement(
String sql, {List< Variable< args = const [], Iterable<Object> >TableUpdate> updates = const {}}) → BatchedStatement -
Executes the custom
sqlstatement with variables instantiated toargs. -
delete<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, Insertable<Row> row) → BatchedStatement -
Deletes
rowfrom thetablewhen this batch is executed. -
deleteAll<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table) → BatchedStatement -
Deletes ALL rows from
table. -
deleteWhere<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, Expression<bool> filter(RS tbl)) → BatchedStatement -
Deletes all rows from
tablematching the providedfilter. -
insert<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, Insertable<Row> row, {UpsertClause<Row, RS> ? onConflict}) → BatchedStatement -
Inserts a row constructed from the fields in
row. -
insertAll<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, Iterable<Insertable< rows, {UpsertClause<Row> >Row, RS> ? onConflict}) → void -
Inserts all
rowsinto thetable. -
insertAllOnConflictUpdate<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, Iterable<Insertable< rows) → voidRow> > - Equivalent of InsertStatement.insertOnConflictUpdate for multiple rows that will be inserted in this batch.
-
insertFromSelect<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, BaseSelectStatement<BaseSelectStatement, dynamic> select, {required Map<TableColumn< columns, UpsertClause<Object> , Expression<Object> >Row, RS> ? onConflict}) → BatchedStatement -
Inserts rows from the
selectstatement. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replace<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, Insertable<Row> row) → BatchedStatement -
Replaces the
rowfrom thetablewith the updated values. The row in the table with the same primary key will be replaced. -
replaceAll<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, Iterable<Insertable< rows) → voidRow> > -
Helper that calls replace for all
rows. -
toString(
) → String -
A string representation of this object.
inherited
-
update<
Row extends Object, RS extends GeneratedTable< (Row, RS> >GeneratedTable< Row, RS> table, Insertable<Row> row, {Expression<bool> where(RS table)?}) → BatchedStatement -
Writes all present columns from the
rowinto all rows in thetablethat match thewhereclause.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited