executeBatch method
Future<List>
executeBatch(
- List<
String> sqls, { - List<
List< ? paramsList,Object?> > - List<
String> ? dbName, - List<
List< ? tablesList,String> >
override
Execute a batch of SQL statements in a single round-trip (gRPC) or sequentially (native). Each statement is processed through execute so INSERT/UPDATE/DELETE return their scalar result.
Returns a list of results in the same order as sqls.
Each result is the scalar value (last_insert_rowid, changes, etc.)
or null for statements that don't produce one.
Implementation
@override
Future<List<dynamic>> executeBatch(
List<String> sqls, {
List<List<Object?>>? paramsList,
List<String>? dbName,
List<List<String>>? tablesList,
}) async {
final requests = <SqlQueryRequest>[];
final count = sqls.length;
for (int i = 0; i < count; i++) {
requests.add(SqlQueryRequest(
sql: sqls[i],
params: convertParamsToParam(paramsList?[i] ?? []),
dbName: dbName?[i] ?? defaultDBName,
tables: tablesList?[i] ?? [],
));
}
final response = await client.executeBatch(BatchRequest(requests: requests));
return response.responses
.map((r) => dartFromValue(r.result))
.toList();
}