Skip to content

Commit 72b3419

Browse files
committed
Fix parameter binding issue.
Introduce a new `bind_block` method. Mimicking this change in the postgres adapter: rails/rails@2b35775 Provides the expected :aN formatted bind parameter values needed by oci8. Thanks to dlaggero for this. #2424 (comment)
1 parent 368a3c5 commit 72b3419

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

lib/arel/visitors/oracle.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,6 @@ def split_order_string(string)
195195
array
196196
end
197197

198-
def visit_ActiveModel_Attribute(o, collector)
199-
collector.add_bind(o) { |i| ":a#{i}" }
200-
end
201-
202-
def visit_Arel_Nodes_BindParam(o, collector)
203-
collector.add_bind(o.value) { |i| ":a#{i}" }
204-
end
205-
206198
def is_distinct_from(o, collector)
207199
collector << "DECODE("
208200
collector = visit [o.left, o.right, 0, 1], collector

lib/arel/visitors/oracle12.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,6 @@ def visit_Arel_Nodes_UpdateStatement(o, collector)
100100
super
101101
end
102102

103-
def visit_ActiveModel_Attribute(o, collector)
104-
collector.add_bind(o) { |i| ":a#{i}" }
105-
end
106-
107-
def visit_Arel_Nodes_BindParam(o, collector)
108-
collector.add_bind(o.value) { |i| ":a#{i}" }
109-
end
110-
111103
def is_distinct_from(o, collector)
112104
collector << "DECODE("
113105
collector = visit [o.left, o.right, 0, 1], collector

lib/arel/visitors/oracle_common.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
module Arel # :nodoc: all
44
module Visitors
55
module OracleCommon
6+
7+
BIND_BLOCK = proc { |i| ":a#{i}" }
8+
private_constant :BIND_BLOCK
9+
10+
def bind_block; BIND_BLOCK; end
11+
612
private
713
# Oracle can't compare CLOB columns with standard SQL operators for comparison.
814
# We need to replace standard equality for text/binary columns to use DBMS_LOB.COMPARE function.

0 commit comments

Comments
 (0)