class Arel::Visitors::H2

Public Instance Methods

limit_offset(sql, o) click to toggle source
# File lib/arel/visitors/h2.rb, line 12
def limit_offset sql, o
  offset = o.offset || 0
  offset = offset.expr unless (offset.nil? || offset == 0)
  if limit = o.limit
    "SELECT LIMIT #{offset} #{limit_for(limit)} #{sql[7..-1]}"
  elsif offset > 0
    "SELECT LIMIT #{offset} -1 #{sql[7..-1]}" # removes "SELECT "
  else
    sql
  end
end
visit_Arel_Nodes_SelectStatement(o, *) click to toggle source
# File lib/arel/visitors/h2.rb, line 7
def visit_Arel_Nodes_SelectStatement(o, *)
  o.limit ||= Arel::Nodes::Limit.new(-1) if o.offset
  super
end