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

Bug #18827 _getRecords not retrieving records into $recordSet[] array
Submitted: 2011-09-12 23:24 UTC
From: ghada Assigned:
Status: Open Package: Structures_DataGrid_DataSource_MDB2 (version 0.1.11)
PHP Version: 5.3.1 OS: Windows 7
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 : 38 - 5 = ?

 
 [2011-09-12 23:24 UTC] ghada (ghada el)
Description: ------------ - Database: MSSQL 2008 R2 - Compatibility level 2000 - File with error: Structures/DataGrid/DataSource/MDB2.php - Function with error: _getRecords When the number of rows coming back from the DB is more than the limit passed to the DataGrid, the numRows() returns 0. Otherwise, it returns "a value". I've tried to put a count query in the options but it ignores it in this function. The follow line: if ($result->numRows()) { is not really required as the while loop will not be entered if there are no rows (i.e. fetchRow() will not return anything). Once the if statement is removed, it works fine. This is what the function now looks like once I commented out the line: function _getRecords($query, $limit, $offset) { if (is_null($limit)) { if ($offset == 0) { $result = $this->_handle->query($query); } else { $result = $this->_handle->extended->limitQuery($query, null, PHP_INT_MAX, $offset); } } else { $result = $this->_handle->extended->limitQuery($query, null, $limit, $offset); } if (PEAR::isError($result)) { return $result; } $recordSet = array(); // Fetch the data while ($record = $result->fetchRow(MDB2_FETCHMODE_ASSOC)) { $recordSet[] = $record; } $result->free(); return $recordSet; }

Comments

 [2011-09-12 23:46 UTC] ghada (ghada el)
Correction: When the number of rows coming back from the DB is **LESS THAN** the limit passed to the DataGrid, the error occurs. i.e. rows from DB = 60; limit passed to Grid = 100. Sorry about the mix up.