1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Support locking in Oracle

This commit is contained in:
Edgars Beigarts 2011-08-26 15:19:36 +03:00
parent 83a5d4d4e3
commit bca49f4e5b
2 changed files with 11 additions and 0 deletions

View file

@ -3,6 +3,10 @@ module Arel
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)

View file

@ -143,6 +143,13 @@ module Arel
( 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