diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-05-06 11:58:57 -0500 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2016-05-06 11:58:57 -0500 |
commit | cff88eaa6b385f887c2e4d12342ddeb0651f1017 (patch) | |
tree | a3f7551e50c9e8696a1f14aecbe77ff3de92425e | |
parent | bc4c02b68f0e08c45bc7a62807196bf68c9bae72 (diff) | |
parent | 653966773238f82c78b4aa55379e624cd407e588 (diff) | |
download | rails-cff88eaa6b385f887c2e4d12342ddeb0651f1017.tar.gz rails-cff88eaa6b385f887c2e4d12342ddeb0651f1017.tar.bz2 rails-cff88eaa6b385f887c2e4d12342ddeb0651f1017.zip |
Merge pull request #422 from yahonda/oracle12_support_bind_value
Support Oracle bind parameter value for Oracle12 visitor
-rw-r--r-- | lib/arel/visitors/oracle12.rb | 4 | ||||
-rw-r--r-- | test/visitors/test_oracle12.rb | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/lib/arel/visitors/oracle12.rb b/lib/arel/visitors/oracle12.rb index d21a829848..9b722e8c0c 100644 --- a/lib/arel/visitors/oracle12.rb +++ b/lib/arel/visitors/oracle12.rb @@ -50,6 +50,10 @@ module Arel super end + + def visit_Arel_Nodes_BindParam o, collector + collector.add_bind(o) { |i| ":a#{i}" } + end end end end diff --git a/test/visitors/test_oracle12.rb b/test/visitors/test_oracle12.rb index 3263007ddb..5dac2994cf 100644 --- a/test/visitors/test_oracle12.rb +++ b/test/visitors/test_oracle12.rb @@ -2,9 +2,10 @@ require 'helper' module Arel module Visitors - describe 'the oracle visitor' do + describe 'the oracle12 visitor' do before do - @visitor = Oracle12.new Table.engine.connection_pool + @visitor = Oracle12.new Table.engine.connection + @table = Table.new(:users) end def compile node @@ -43,6 +44,16 @@ module Arel compile(node).must_be_like "FOR UPDATE" end end + + describe "Nodes::BindParam" do + it "increments each bind param" do + query = @table[:name].eq(Arel::Nodes::BindParam.new) + .and(@table[:id].eq(Arel::Nodes::BindParam.new)) + compile(query).must_be_like %{ + "users"."name" = :a1 AND "users"."id" = :a2 + } + end + end end end end |