Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #19924 find() - LIMIT part is not showing in the query debug output when using MDB2
Submitted: 2013-04-30 14:18 UTC
From: shankao Assigned:
Status: Open Package: DB_DataObject (version 1.11.2)
PHP Version: 5.4.9 OS: Ubuntu
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 33 - 23 = ?

 
 [2013-04-30 14:18 UTC] shankao (shankao asdasd)
Description: ------------ Adding a limit() to a find() query with MDB2. In the debug output, the LIMIT part does not appear, even if it seems to be done by MDB2 correctly. This patch fixes the problem, although adds the LIMIT clause to the actual query manually and it could be different with other DBMS (tested on MySQL) and give problems on that case. Note that the $sql variable is updated if the PEAR::DB engine is used instead. Index: DB/DataObject.php ====================================== ============================= --- DB/DataObject.php (revision 330166) +++ DB/DataObject.php (working copy) @@ -444,6 +444,8 @@ /* theoretically MDB2! */ if (isset($this->_query['limit_start']) && strlen($this->_query['limit_start'] . $this- >_query['limit_count'])) { $DB->setLimit($this- >_query['limit_count'],$this->_query['limit_start']); + $sql .= ' LIMIT '.$this- >_query['limit_count']; + $sql .= $this->_query['limit_start']? ','.$this->_query['limit_start'] : ''; } } Test script: --------------- Something like this should do it: $a = new DB_DataObject; $a->limit(1); $a->find(); Expected result: ---------------- In the debug output, the query should show a "LIMIT 1" part Actual result: -------------- The LIMIT part does not appear.

Comments