Class: Arel::Visitors::Derby

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

Instance Method Summary collapse

Methods included from ArJdbcCompat

#limit_for

Instance Method Details

#visit_Arel_Nodes_Offset(o) ⇒ Object



16
17
18
# File 'lib/arel/visitors/derby.rb', line 16

def visit_Arel_Nodes_Offset o
  "OFFSET #{visit o.value} ROWS"
end

#visit_Arel_Nodes_SelectStatement(o) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/arel/visitors/derby.rb', line 6

def visit_Arel_Nodes_SelectStatement o
  [
   o.cores.map { |x| visit_Arel_Nodes_SelectCore x }.join,
   ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?),
   ("FETCH FIRST #{limit_for(o.limit)} ROWS ONLY" if o.limit),
   (visit(o.offset) if o.offset),
   (visit(o.lock) if o.lock),
  ].compact.join ' '
end