execute method

  1. @override
void execute(
  1. TSQLCursor cursor,
  2. TSQLTransaction? aTransaction,
  3. TParams? aParams
)
override

Implementation

@override
void execute(TSQLCursor cursor, TSQLTransaction? aTransaction,
    TParams? aParams) {
  final c = cursor as TWapCursor;
  if (c.fSelectable) {
    // @@@ SELECT data must be preloaded via openAsync first (see the design note in the file header)
    if (!c.executed) {
      databaseError(
          "@@@ SELECT needs to be asynchronously preloaded via openAsync() before open() can be called; "
          'please change q.open() to await q.openAsync()', this);
    }
    c.rowIndex = -1; // resets the traversal position
  } else {
    // @@@ DML: pushed into the pending-send queue, actually sent when flushPending() runs
    _pendingDML.add(_PendingDML(c.preparedSQL, _bindArgs(c, aParams)));
    _lastRowsAffected = -1;
  }
}