insertAll<T extends Table, D> method

void insertAll<T extends Table, D>(
  1. TableInfo<T, D> table,
  2. Iterable<Insertable<D>> rows, {
  3. InsertMode? mode,
  4. UpsertClause<T, D>? onConflict,
})

Inserts all rows into the table.

All fields in a row that don't have a default value or auto-increment must be set and non-null. Otherwise, an InvalidDataException will be thrown. By default, an exception will be thrown if another row with the same primary key already exists. This behavior can be overridden with mode, for instance by using InsertMode.replace or InsertMode.insertOrIgnore. Using insertAll will not disable primary keys or any column constraint checks. onConflict can be used to create an upsert clause for engines that support it. For details and examples, see InsertStatement.insert.

Implementation

void insertAll<T extends Table, D>(
    TableInfo<T, D> table, Iterable<Insertable<D>> rows,
    {InsertMode? mode, UpsertClause<T, D>? onConflict}) {
  for (final row in rows) {
    insert<T, D>(table, row, mode: mode, onConflict: onConflict);
  }
}