aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/visitors/oracle.rb4
-rw-r--r--test/visitors/test_oracle.rb13
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb
index 91f6e0223e..ff9e38d050 100644
--- a/lib/arel/visitors/oracle.rb
+++ b/lib/arel/visitors/oracle.rb
@@ -132,6 +132,10 @@ module Arel
array
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_oracle.rb b/test/visitors/test_oracle.rb
index 29d7042084..41e77d93c0 100644
--- a/test/visitors/test_oracle.rb
+++ b/test/visitors/test_oracle.rb
@@ -4,7 +4,8 @@ module Arel
module Visitors
describe 'the oracle visitor' do
before do
- @visitor = Oracle.new Table.engine.connection_pool
+ @visitor = Oracle.new Table.engine.connection
+ @table = Table.new(:users)
end
def compile node
@@ -165,6 +166,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