Class: Arel::Visitors::Derby
Instance Method Summary collapse
- #visit_Arel_Nodes_Limit(o) ⇒ Object
-
#visit_Arel_Nodes_Lock(o) ⇒ Object
This generates SELECT…FOR UPDATE, but it will only work if the current transaction isolation level is set to SERIALIZABLE.
- #visit_Arel_Nodes_Offset(o) ⇒ Object
- #visit_Arel_Nodes_SelectStatement(o) ⇒ Object
Methods included from ArJdbcCompat
Instance Method Details
#visit_Arel_Nodes_Limit(o) ⇒ Object
16 17 18 |
# File 'lib/arel/visitors/derby.rb', line 16 def visit_Arel_Nodes_Limit o "FETCH FIRST #{limit_for(o)} ROWS ONLY" end |
#visit_Arel_Nodes_Lock(o) ⇒ Object
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.
27 28 29 |
# File 'lib/arel/visitors/derby.rb', line 27 def visit_Arel_Nodes_Lock o visit o.expr end |
#visit_Arel_Nodes_Offset(o) ⇒ Object
20 21 22 |
# File 'lib/arel/visitors/derby.rb', line 20 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(x) }.join, ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?), (visit(o.offset) if o.offset), (visit(o.limit) if o.limit), (visit(o.lock) if o.lock), ].compact.join ' ' end |