Closed yahonda closed 7 years ago
r? @rafaelfranca
(@rails-bot has picked a reviewer for you, use r? to override)
Updated pull request to reflect reviews.
Note: this method needs to bind offset
value twice. The bind value name for the second offset
changed from :b1
to :b3
by using visitor pattern here and confirmed the first offset :b1
and the second offset :b3
have the same value.
Current behavior with this pull request
D, [2017-07-25T22:16:51.986248 #27602] DEBUG -- : Load (4.1ms)
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (SELECT "TEST_EMPLOYEES".* FROM "TEST_EMPLOYEES" ORDER BY "TEST_EMPLOYEES"."SORT_ORDER" ASC ) raw_sql_ WHERE rownum <= (:a1 + :a2) ) WHERE raw_rnum_ > :a3 [["OFFSET", 0], ["LIMIT", 1], ["OFFSET", 0]]
D, [2017-07-25T22:16:51.989567 #27602] DEBUG -- : Load (1.0ms)
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (SELECT "TEST_EMPLOYEES".* FROM "TEST_EMPLOYEES" ORDER BY "TEST_EMPLOYEES"."SORT_ORDER" ASC ) raw_sql_ WHERE rownum <= (:a1 + :a2) ) WHERE raw_rnum_ > :a3 [["OFFSET", 1], ["LIMIT", 1], ["OFFSET", 1]]
D, [2017-07-25T22:16:51.991870 #27602] DEBUG -- : Load (0.6ms)
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (SELECT "TEST_EMPLOYEES".* FROM "TEST_EMPLOYEES" ORDER BY "TEST_EMPLOYEES"."SORT_ORDER" ASC ) raw_sql_ WHERE rownum <= (:a1 + :a2) ) WHERE raw_rnum_ > :a3 [["OFFSET", 4], ["LIMIT", 1], ["OFFSET", 4]]
Previous behavior
D, [2017-07-25T22:18:01.061554 #27751] DEBUG -- : Load (4.8ms)
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (SELECT "TEST_EMPLOYEES".* FROM "TEST_EMPLOYEES" ORDER BY "TEST_EMPLOYEES"."SORT_ORDER" ASC ) raw_sql_ WHERE rownum <= (:a1 + :a2) ) WHERE raw_rnum_ > :a1 [["OFFSET", 0], ["LIMIT", 1]]
D, [2017-07-25T22:18:01.065624 #27751] DEBUG -- : Load (1.1ms)
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (SELECT "TEST_EMPLOYEES".* FROM "TEST_EMPLOYEES" ORDER BY "TEST_EMPLOYEES"."SORT_ORDER" ASC ) raw_sql_ WHERE rownum <= (:a1 + :a2) ) WHERE raw_rnum_ > :a1 [["OFFSET", 1], ["LIMIT", 1]]
D, [2017-07-25T22:18:01.068899 #27751] DEBUG -- : Load (1.0ms)
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (SELECT "TEST_EMPLOYEES".* FROM "TEST_EMPLOYEES" ORDER BY "TEST_EMPLOYEES"."SORT_ORDER" ASC ) raw_sql_ WHERE rownum <= (:a1 + :a2) ) WHERE raw_rnum_ > :a1 [["OFFSET", 4], ["LIMIT", 1]]
Ah I see. In that case your original fix was the right thing to do.
Pushed the original fix again.
I've found the original fix did not resolve this error when tested with JRuby and JDBC driver since bind value naming convention differences between OCI(for CRuby) and JDBC(for JRuby).
Java::JavaSql::SQLException: Missing IN or OUT parameter at index:: 3:
https://travis-ci.org/rsim/oracle-enhanced/jobs/257787629
Going back to visitor pattern again and it works with both CRuby and JRuby.
r? @sgrif
Refer https://github.com/rails/arel/commit/53521a9e39b9d8af4165d7703c36dc905f1f8f67
This pull request addresses this failure at Oracle enhanced unit test.