Module: ArJdbc::MsSQL::LimitHelpers::SqlServer2000AddLimitOffset

Defined in:
lib/arjdbc/mssql/limit_helpers.rb

Instance Method Summary collapse

Instance Method Details

#add_limit_offset!(sql, options) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/arjdbc/mssql/limit_helpers.rb', line 78

def add_limit_offset!(sql, options)
  if options[:limit]
    order = "ORDER BY #{options[:order] || determine_order_clause(sql)}"
    sql.sub!(/ ORDER BY.*$/i, '')
    SqlServer2000ReplaceLimitOffset.replace_limit_offset!(sql, options[:limit], options[:offset], order)
  end
end