Class: Arel::Visitors::DB2

Inherits:
ToSql
  • Object
show all
Defined in:
lib/arel/visitors/db2.rb

Instance Method Summary collapse

Methods included from ArJdbcCompat

#limit_for

Instance Method Details

#add_limit_offset(sql, o) ⇒ Object



12
13
14
# File 'lib/arel/visitors/db2.rb', line 12

def add_limit_offset(sql, o)
  @connection.replace_limit_offset! sql, limit_for(o.limit), o.offset && o.offset.value
end

#visit_Arel_Nodes_SelectStatement(o) ⇒ Object



6
7
8
9
10
# File 'lib/arel/visitors/db2.rb', line 6

def visit_Arel_Nodes_SelectStatement o
  add_limit_offset([o.cores.map { |x| visit_Arel_Nodes_SelectCore x }.join,
   ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?),
  ].compact.join(' '), o)
end