rails / arel

A Relational Algebra
2.06k stars 390 forks source link

Use Arel::Nodes::BindParam in Oracle visitor for queries using both LIMIT and OFFSET #450

Closed roooodcastro closed 7 years ago

roooodcastro commented 7 years ago

This is to fix #438, where the Oracle visitor is raising an undefined method error when trying to calculate the limit for queries specifying both limit and offset.

Since this commit, ActiveModel now uses BindParams to pass limit and offset parameters to Arel, so it now isn't able to calculate the limit directly.

In this fix, when a BindParam object is passed to visit_Arel_Nodes_SelectStatement, it now will use this binding instead of calculating the values. The previous behaviour remains when the offset expression is not a BindParam object.

rails-bot commented 7 years ago

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @rafaelfranca (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

rafaelfranca commented 7 years ago

Backported in 8813ad8