2010年2月25日星期四

Re: [fw-db] Parsing through large result sets

There is a $db->query() method, which returns a resource-like class, on
which you can perform $res->fetch()

Regards,

Pieter Kokx
PHP Developer
Zend Framework developer

janpolsen schreef:
> Oi
>
> Now I have googled through various search queries for the last two
> hours and I'm about to toss the towel.
>
> I am used to do something like this:
> $sql = "SELECT something FROM random-table-with-an-obscene-large-amount-of-entries";
> $res = mssql_query($sql);
> while ($row = mssql_fetch_array($res)) {
> // do some with the data returned in $row
> }
>
> Now I have moved over to Zend_Db and want to do the very same thing,
> but how?
> Some places I use a simple straight through approach like:
> $sql = "SELECT something FROM random-table-with-a-small-amount-of-data";
> $rows = $db->fetchAll($sql);
> foreach ($rows AS $row) {
> // do some with the data returned in $row
> }
>
> However I run into memory problems, if I use that approach with my
> |random-table-with-an-obscene-large-amount-of-entries|.
>
> What am I missing here? Isn't it possible to use a |while()-structure|
> to loop through a Zend_Db result set? Thanks in advance...
> ------------------------------------------------------------------------
> View this message in context: Parsing through large result sets
> <http://www.nabble.com/Parsing-through-large-result-sets-tp20264357p20264357.html>
> Sent from the Zend DB mailing list archive
> <http://www.nabble.com/Zend-DB-f16192.html> at Nabble.com.

没有评论: