Welcome Guest, Not a member yet? Register   Sign In
Oracle (oci8) limit off by 1
#1

[eluser]Unknown[/eluser]
This issue may not exactly be a bug, but it may lead to unexpected/confusing behavior. Specifying a limit of 10, one would expect to see up to 10 rows returned, but currently it only shows at most 9.

The Oracle limit feature is determined by the row number of the query results, starting at 1. CI_DB_oci8_driver's _limit function has the following:
Code:
$newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)";

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

[eluser]nebulom[/eluser]
See if this, http://ellislab.com/forums/viewthread/112857/, helps.




Theme © iAndrew 2016 - Forum software by © MyBB