openAsync method

Future<void> openAsync()

@@@ SELECT: prepare → await fetches the whole batch → loads it into the cursor → synchronous open()

Implementation

Future<void> openAsync() async {
  final conn = _wapConn;
  conn._checkDriver();
  conn.maybeConnect();
  prepare(); // goes through the faithful pipeline: macro expansion/GetStatementInfo/prepareStatement
  final c = cursor as TWapCursor;
  if (c.fSelectable) {
    final res = await conn.driver!
        .rawQuery(c.preparedSQL, conn._bindArgs(c, params));
    if (!res.success) {
      throw ESQLDatabaseError.createFmt(
          res.errorMessage ?? 'query failed', [], conn, 0, "");
    }
    c.rows = res.data;
    c.columns = res.columns;
    c.executed = true;
  }
  open(); // the faithful, unmodified synchronous pipeline (execute will see executed=true)
}