You should be choosing the proper mysql extension based on your needs. Mysqli is great for scripts that do alot of data-warehouse type of iterations (due to its forward-only moving cursor by default). PDO on the other hand is great for "object model" kind of stuff because by default, it buffers result sets.

You have two options:

  * Use PDO

OR

  * Instruct Mysqli to buffer your result sets

$resultSet->getDataSource()->getResource()->store_result();

Be advised though that doing this will tend to use more application memory since your database results are now in PHP memory space.

-ralph

On 3/26/12 9:37 AM, duke wrote:
I know but you suggestion:
foreach ($resultSet as $row) {}

as I've wrote, will emit "mysql out of sync error" when another module
(or event) use db driver. To resolve that we must loop at resultSet and
get data,
but not convert all row object to array.



On 26/03/12 17:12, ralphschindler [via Zend Framework Community] wrote:
In general, if you have a toArray() method, it is generally accepted
that the return value of that method will be a PHP type array.

If you are wanting to get the objects in your view, simply iterate over
the ResultSet.  The default return type in the default ResultSet is a
RowObject which is actually an extension of ArrayObject.

foreach ($resultSet as $row) {}

as opposed to:

foreach ($resultSet->toArray() as $row) {}

-ralph




--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to