class Arel::Visitors::Derby
Constants
- STR_1
@private
- VALUES_DEFAULT
@private
Public Instance Methods
visit_Arel_Nodes_InsertStatement(o, a = nil)
click to toggle source
# File lib/arel/visitors/derby.rb, line 69 def visit_Arel_Nodes_InsertStatement o, a = nil a << "INSERT INTO " visit(o.relation, a) values = o.values if o.columns.any? cols = o.columns.map { |x| quote_column_name x.name } a << ' (' << cols.join(', ') << ') ' elsif o.values.eql? VALUES_DEFAULT cols = o.relation.engine.columns.map { |c| c.name } a << ' (' << cols.join(', ') << ')' a << ' VALUES ' a << ' (' << cols.map { 'DEFAULT' }.join(', ') << ')' values = false end visit(values, a) if values a end
visit_Arel_Nodes_Limit(o, a = nil)
click to toggle source
# File lib/arel/visitors/derby.rb, line 42 def visit_Arel_Nodes_Limit(o, a = nil) limit = "FETCH FIRST #{limit_for(o)} ROWS ONLY" a << limit if a limit 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 61 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 48 def visit_Arel_Nodes_Offset(o, a = nil) if a a << 'OFFSET ' do_visit(o.value, a) a << ' ROWS' else "OFFSET #{do_visit o.value, a} ROWS" end end
visit_Arel_Nodes_SelectStatement(o, a = nil)
click to toggle source
# File lib/arel/visitors/derby.rb, line 11 def visit_Arel_Nodes_SelectStatement(o, a = nil) a = o.cores.inject(a) { |c, x| visit_Arel_Nodes_SelectCore(x, c) } unless o.orders.empty? a << ' ORDER BY ' last = o.orders.length - 1 o.orders.each_with_index do |x, i| visit(x, a); a << ', ' unless last == i end end if o.offset a << STR_1; visit(o.offset, a) end if o.limit a << STR_1; visit(o.limit, a) end if o.lock a << STR_1; visit(o.lock, a) end a end