scopedQuery method

MssqlQuery scopedQuery(
  1. MssqlScopeSelection selection, {
  2. MssqlScopeCompiler? scopes,
})

A SELECT with no projection, only scope conditions — for exists and count, which do not need the full column list.

scopes carries the operation's snapshot, as in baseQuery.

Implementation

MssqlQuery scopedQuery(
  MssqlScopeSelection selection, {
  MssqlScopeCompiler? scopes,
}) {
  var query = MssqlQuery.fromParts(binding.nameParts, ref: binding.sourceRef);
  for (final condition
      in (scopes ?? scopeCompiler(selection)).readConditions) {
    query = query.where(condition);
  }
  return query;
}