diff options
author | Yasuo Honda <yasuo.honda@gmail.com> | 2017-07-25 19:00:12 +0000 |
---|---|---|
committer | Yasuo Honda <yasuo.honda@gmail.com> | 2017-07-25 19:46:43 +0000 |
commit | f25ee14a470d7505098fd3fdae04ddcffe70f2e2 (patch) | |
tree | 104cb56c7aa6bb40865f05df2bf6ca2d145b6ea3 | |
parent | f4227bf20a16a1d688afc24cf0038e2f98905dd4 (diff) | |
download | rails-f25ee14a470d7505098fd3fdae04ddcffe70f2e2.tar.gz rails-f25ee14a470d7505098fd3fdae04ddcffe70f2e2.tar.bz2 rails-f25ee14a470d7505098fd3fdae04ddcffe70f2e2.zip |
Address `undefined method `value_for_database'` in Oracle visitor
Here `offset` is bound twice. It used to be `:b1` appeared twice.
This commit changes the second `offset` name changed from `:b1` to `:b3`
which should not affect the actual bind values for offset.
-rw-r--r-- | lib/arel/visitors/oracle.rb | 7 | ||||
-rw-r--r-- | test/visitors/test_oracle.rb | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index c1e41be66f..95c37eba6b 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -31,10 +31,11 @@ module Arel if offset.expr.is_a? Nodes::BindParam offset_bind = nil collector << ') raw_sql_ WHERE rownum <= (' - collector.add_bind(offset.expr) { |i| offset_bind = ":a#{i}" } + collector = visit offset.expr, collector collector << ' + ' - collector.add_bind(limit) { |i| ":a#{i}" } - collector << ") ) WHERE raw_rnum_ > #{offset_bind}" + collector = visit limit, collector + collector << ") ) WHERE raw_rnum_ > " + collector = visit offset.expr, collector return collector else collector << ") raw_sql_ diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb index 603d0f1184..fce6606d35 100644 --- a/test/visitors/test_oracle.rb +++ b/test/visitors/test_oracle.rb @@ -136,7 +136,7 @@ module Arel FROM (SELECT ) raw_sql_ WHERE rownum <= (:a1 + :a2) ) - WHERE raw_rnum_ > :a1 + WHERE raw_rnum_ > :a3 } end |