I'm using a concrete implementation of Zend_Db_Table_Abstract:
class DB_TestClass extends Zend_Db_Table_Abstract {
protected $_name = "test.TestData";
}
If I want select all rows in the table, I seem to have one option:
$t = new DB_TestClass;
$rowset = $t->fetchAll();
This returns an instance of Zend_Db_Table_Rowset which has an iterable interface you can loop though and access each row entry as a rowClass instance:
foreach($rowset as $row) {
var_dump($row);
}
HOWEVER, the rowset has loaded every row from the database into memory(!) On small tables this is OK, but on large tables - thousands of rows, for example - it quickly exhausts the memory available to PHP and the script dies.
How can I, using Zend_Db, iterate through the result set retrieving one row from a statement handle at a time, ala mysql_fetch_assoc()? This would allow efficient access to any number of rows (thousands, millions) without using excessive memory.
Thanks in advance for any suggestions.