diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-26 08:48:09 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-26 08:48:09 -0700 |
commit | 2aac990e4d68cc3cbf86ecc9565723b07f22c962 (patch) | |
tree | ef905cfffe43295268b7dc963a4b263b1598ce6a | |
parent | 83a5d4d4e37a2c72824315597cb8b737f37b7960 (diff) | |
parent | bca49f4e5beaa135a9b96270426968793550b708 (diff) | |
download | rails-2aac990e4d68cc3cbf86ecc9565723b07f22c962.tar.gz rails-2aac990e4d68cc3cbf86ecc9565723b07f22c962.tar.bz2 rails-2aac990e4d68cc3cbf86ecc9565723b07f22c962.zip |
Merge pull request #77 from ebeigarts/master
Support locking in Oracle
-rw-r--r-- | lib/arel/visitors/oracle.rb | 4 | ||||
-rw-r--r-- | test/visitors/test_oracle.rb | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index 375f7dbfe9..43a382886c 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -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) diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb index b53690a1a8..9a5fa304ab 100644 --- a/test/visitors/test_oracle.rb +++ b/test/visitors/test_oracle.rb @@ -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 |