executeBatch method

  1. @override
Future<void> executeBatch(
  1. String sql,
  2. List<List<Object?>> parameterSets
)
override

Execute a write query (INSERT, UPDATE, DELETE) multiple times with each parameter set. This is faster than executing separately with each parameter set.

Implementation

@override
Future<void> executeBatch(
    String sql, List<List<Object?>> parameterSets) async {
  return computeWithDatabase((db) async {
    final statement = db.prepare(sql, checkNoTail: true);
    try {
      for (var parameters in parameterSets) {
        statement.execute(parameters);
      }
    } finally {
      statement.dispose();
    }
  });
}