?
Referenced as Pull Request for: # 6234
avatar bcordis
bcordis
28 Feb 2015

Steps to reproduce the issue

When trying to set the limit on setQuery($items, 0, 5) no effect.

Expected result

Results should be limited to 5

Actual result

Unlimited results

System information (as much as possible)

Setting Value

PHP Built On Linux ps20763 3.1.9-vs2.3.2.5vs2.3.2.5+ #3 SMP Wed Feb 12 13:51:29 PST 2014 x86_64
Database Version 5.1.56-log
Database Collation utf8_general_ci
PHP Version 5.4.37
Web Server Apache
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.4.0 Stable [ Ember ] 24-February-2015 23:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.74 Safari/537.36

Additional comments

avatar bcordis bcordis - open - 28 Feb 2015
avatar brianteeman brianteeman - change - 28 Feb 2015
Labels Added: ?
avatar bcordis bcordis - change - 28 Feb 2015
The description was changed
avatar bcordis
bcordis - comment - 28 Feb 2015

Update info for error.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6232.
avatar bcordis
bcordis - comment - 28 Feb 2015

$db->setQuery() limit has no affect under the PDO driver but works on mysqli

avatar PhilETaylor
PhilETaylor - comment - 28 Feb 2015

Confirmed with code in this Gist https://gist.github.com/bdf4c5a29b6097098922

Should output 5 5 5 - but with JDatabaseDriverPdomysql we get 152 (or a number larger than 5 depending on your test data - but still, should be 5! )

avatar mbabker
mbabker - comment - 28 Feb 2015

From what I could tell without actually testing, it's because of the handling in JDatabaseDriverPdo::setQuery() that manipulates the query before passing up to the parent JDatabaseDriver::setQuery(). Unrelated to this issue, there appears to be a strict standards issue in the first method I described due to the extended method signature.

avatar PhilETaylor
PhilETaylor - comment - 28 Feb 2015

Added PR #6234 that works with the test gist above, might not be the most comprehensive fix - but works and can be tested.

avatar PhilETaylor
PhilETaylor - comment - 28 Feb 2015

@mbabker In the PR I have removed the driverOptions additional param to setQuery to bring it inline with the other JDatabaseDriver::setQuery and reused the options used at construct time.

avatar brianteeman
brianteeman - comment - 28 Feb 2015

Closed as we have a Pr - thanks


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6232.
avatar brianteeman brianteeman - change - 28 Feb 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-02-28 23:22:25
Closed_By brianteeman
avatar brianteeman brianteeman - change - 28 Feb 2015
Closed_Date 2015-02-28 23:22:25 2015-02-28 23:22:26
avatar brianteeman brianteeman - close - 28 Feb 2015

Add a Comment

Login with GitHub to post a comment