preparedWithAll method

Stream<StreamedResults> preparedWithAll(
  1. String sql,
  2. Iterable<Iterable> values
)
override

Implementation

Stream<StreamedResults> preparedWithAll(String sql, Iterable<Iterable> values) {
  var controller = StreamController<StreamedResults>();

  _socket.execHandler(PrepareHandler(sql), _timeout).then((r) async {
    PreparedQuery prepared = r;
    try {
      for (int i = 0; i < values.length; i++) {
        Iterable v = values.elementAt(i);
        var handler = ExecuteQueryHandler(prepared, false, v as List<dynamic>);
        controller.add(await _socket.execResultHandler(handler, _timeout));
      }
      await controller.close();
    } catch (e) {
      controller.addError(e);

      _socket.execHandlerNoResponse(CloseStatementHandler(prepared.statementHandlerId), _timeout);

      await controller.close();
      rethrow;
    }
  });

  return controller.stream;
}