Parent

Files

Class/Module Index [+]

Quicksearch

Arel::Visitors::Derby

Public Instance Methods

visit_Arel_Nodes_Limit(o, a = nil) click to toggle source
# File lib/arel/visitors/derby.rb, line 16
def visit_Arel_Nodes_Limit o, a = nil
  "FETCH FIRST #{limit_for(o)} ROWS ONLY"
end
visit_Arel_Nodes_Lock(o, a = nil) click to toggle source

This generates SELECT…FOR UPDATE, but it will only work if the current transaction isolation level is set to SERIALIZABLE. Otherwise, locks aren’t held for the entire transaction.

# File lib/arel/visitors/derby.rb, line 27
def visit_Arel_Nodes_Lock o, a = nil
  do_visit o.expr, a
end
visit_Arel_Nodes_Offset(o, a = nil) click to toggle source
# File lib/arel/visitors/derby.rb, line 20
def visit_Arel_Nodes_Offset o, a = nil
  "OFFSET #{do_visit o.value, a} ROWS"
end
visit_Arel_Nodes_SelectStatement(o, a = nil) click to toggle source
# File lib/arel/visitors/derby.rb, line 7
def visit_Arel_Nodes_SelectStatement o, a = nil
  sql = o.cores.map { |x| do_visit(x, a) }.join
  sql << " ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?
  sql << " #{do_visit o.offset, a}" if o.offset
  sql << " #{do_visit o.limit, a}" if o.limit
  sql << " #{do_visit o.lock, a}" if o.lock
  sql
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.