applyLimit static method

SqlStatement applyLimit(
  1. SqlStatement statement,
  2. int count
)

Adds a LIMIT clause to a SqlStatement. Replaces existing LIMIT.

Implementation

static SqlStatement applyLimit(SqlStatement statement, int count) {
  if (statement.operationType != SqlOperationType.select) {
    print("Warning: Applying LIMIT to non-SELECT statement.");
  }
  if (count < 0) {
    throw ArgumentError('LIMIT count cannot be negative.');
  }
  return statement.copyWith(limit: count);
}