Zend_Db_Table streaming database result
Posted: Thu Jun 12, 2008 9:29 am
I have some problems with the way Zend framework handles my query's.
If you have a Zend_Db_Table extention like:
You can get all nice things from you database without using real sql.
Now i want to get about 2.000.000 records with this oop method of the zend framework.
But..
The Zend_Db_Table will get the recods at once when you requesting your data with databaseMedia->fetchAll(), and databaseMedia->fetchRow() will allwase return the same row (first).
I'm looking for something like:
While the only solution i can find with this framework will be
Does anybody knows how to use this correctly?
If you have a Zend_Db_Table extention like:
Code: Select all
class databaseMedia extends Zend_Db_Table
{
protected $_name = 'media';
protected $_primary = array('id');
protected $_dependentTables = array('databasePublisher');
}
Now i want to get about 2.000.000 records with this oop method of the zend framework.
But..
The Zend_Db_Table will get the recods at once when you requesting your data with databaseMedia->fetchAll(), and databaseMedia->fetchRow() will allwase return the same row (first).
I'm looking for something like:
Code: Select all
$oTable = new databaseMedia($oAdapter);
while($oRow = $oTable->fetchNext())
{
// do something with the individiual data row.
}
Code: Select all
$oTable = new databaseMedia($oAdapter);
$oRows = $oTable->fetchAll(); // huge array now.
foreach($oRows as $oRow)
{
// do something with the individiual data row.
}