Skip to content

Commit b46e078

Browse files
committed
Address Java::JavaSql::SQLException: Missing IN or OUT parameter at index:: 3:
when `offset` and `limit` used at the same time with JRuby and Oracle 11gR2 or lower since rails/arel#450 needs 3 bind variables, `:a1`, `:a2` and `:a1` again. It is probably due to Oracle enhanced adapter JDBC implementation handles bind variables by their order not their name then we need to handle first `:a1` for `offset` and last `:a1` separately.
1 parent d96343a commit b46e078

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/active_record/connection_adapters/oracle_enhanced_adapter.rb

+9-3
Original file line numberDiff line numberDiff line change
@@ -1165,11 +1165,17 @@ def combine_bind_parameters(
11651165
offset: nil
11661166
) # :nodoc:
11671167
result = from_clause + join_clause + where_clause + having_clause
1168-
if offset
1168+
if RUBY_ENGINE == 'jruby' && !supports_fetch_first_n_rows_and_offset? && offset && limit
11691169
result << offset
1170-
end
1171-
if limit
11721170
result << limit
1171+
result << offset
1172+
else
1173+
if offset
1174+
result << offset
1175+
end
1176+
if limit
1177+
result << limit
1178+
end
11731179
end
11741180
result
11751181
end

0 commit comments

Comments
 (0)