Permalink
Browse files

Support locking in Oracle

  • Loading branch information...
1 parent 83a5d4d commit bca49f4e5beaa135a9b96270426968793550b708 @ebeigarts ebeigarts committed Aug 26, 2011
Showing with 11 additions and 0 deletions.
  1. +4 −0 lib/arel/visitors/oracle.rb
  2. +7 −0 test/visitors/test_oracle.rb
@@ -3,6 +3,10 @@ module Visitors
class Oracle < Arel::Visitors::ToSql
private
+ def visit_Arel_Nodes_Lock o
+ visit o.expr
+ end
+
def visit_Arel_Nodes_SelectStatement o
o = order_hacks(o)
@@ -143,6 +143,13 @@ module Visitors
( SELECT * FROM users WHERE age > 10 MINUS SELECT * FROM users WHERE age > 20 )
}
end
+
+ describe 'locking' do
+ it 'defaults to FOR UPDATE when locking' do
+ node = Nodes::Lock.new(Arel.sql('FOR UPDATE'))
+ @visitor.accept(node).must_be_like "FOR UPDATE"
+ end
+ end
end
end
end

0 comments on commit bca49f4

Please sign in to comment.