Welcome Guest, Not a member yet? Register   Sign In
Oracle database drive bug with LIMIT
#1

[eluser]North2Alaska[/eluser]
When I build a query with the Active Record and use the ->Limit(1), the result is never displayed. I displayed the sql and it looks like the Oracle drive is not correct. On line 775 of oci8_driver.php the line of code looks like this

Code:
$newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)";
Because rownum < $limit the value is not included. So if you use Limit(1) the row number with a rownum of 1 is not selected. To fix the bug, simply and an = (equal) so that it becomes <= (less than or equal to).

Code:
$newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum <= $limit)";
#2

[eluser]cpassas[/eluser]
If you think you've found a bug you might be better off posting it here:

https://github.com/EllisLab/CodeIgniter/issues/new




Theme © iAndrew 2016 - Forum software by © MyBB