paged method

MssqlQuery paged({
  1. required int offset,
  2. required int rows,
})

Takes rows rows starting at offset.

Requires an ORDER BY: SQL Server rejects OFFSET without one, and the ROW_NUMBER form has no ordering to number by. The check happens at compile so that the failure names this query rather than arriving as a server syntax error.

Implementation

MssqlQuery paged({required int offset, required int rows}) {
  if (offset < 0) {
    throw ArgumentError.value(offset, 'offset', 'Cannot be negative.');
  }
  if (rows <= 0) {
    throw ArgumentError.value(rows, 'rows', 'Must be positive.');
  }
  return _with(offset: offset, rows: rows);
}