Method: Sequel::MSSQL::DatasetMethods#select_sql

Defined in:
lib/sequel/adapters/shared/mssql.rb

#select_sqlObject

On MSSQL 2012+ add a default order to the current dataset if an offset is used. The default offset emulation using a subquery would be used in the unordered case by default, and that also adds a default order, so it’s better to just avoid the subquery.



761
762
763
764
765
766
767
# File 'lib/sequel/adapters/shared/mssql.rb', line 761

def select_sql
  if @opts[:offset]
    raise(Error, "Using with_ties is not supported with an offset on Microsoft SQL Server") if @opts[:limit_with_ties]
    return order(1).select_sql if is_2012_or_later? && !@opts[:order]
  end
  super
end