compile method

String compile(
  1. MssqlParameterAllocator parameters,
  2. MssqlDialect dialect
)

Implementation

String compile(MssqlParameterAllocator parameters, MssqlDialect dialect) {
  final parts = <String>[];
  if (partitionBy.isNotEmpty) {
    final terms = partitionBy.map((e) => e.compile(parameters, dialect));
    parts.add('PARTITION BY ${terms.join(', ')}');
  }
  if (orderBy.isNotEmpty) {
    // Window ordering cannot carry the paging options used by SELECT.
    final terms = orderBy.map(
      (o) =>
          '${o.expression.compile(parameters, dialect)}'
          '${o.descending ? ' DESC' : ' ASC'}',
    );
    parts.add('ORDER BY ${terms.join(', ')}');
  }
  final bounds = frame;
  if (bounds != null) parts.add(bounds.compile(parameters, dialect));
  return parts.join(' ');
}