RE: [PEAR] Pear DB Questions
| From: | Lukas Smith | Date: | Fri, 26 Sep 2003 16:32:12 +0000 |
| Subject: | RE: [PEAR] Pear DB Questions | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8070@lists.php.net to get a copy of this message | ||
> From: Stowe, Nola [mailto:NStowe@TheTTGroup.com]
> Sent: Friday, September 26, 2003 6:25 PM
>
> I have a function that passes mysql result sets to another function,
then
> in
> the second function I use that resource with ...
mysql_result($l_result,
> $j, 'l_key');
>
> Since I iterate through these result sets alot, I don't really want to
run
> the query everytime I want to run through it and use the DB like
> $result->fetchRow() ... and since these results can be potentially
huge
> (8000 records, avg 20 fields) I dont think I want to fetch the results
> into
> an array, then pass that to the second function.
>
> Any ideas?
Ok his might come as a shock to you .. but mysql_query buffers the
entire result set on the client. Only mysql_unbuffered_query doesn't. Db
uses mysql_query .. so if you fetch the entire result set you don't
really use any more resources.
Furthermore php4 has a smart way of handling this situation. Data is
only copied into a separate memory segement once you change the data:
$foo = 'hello';
$bar = $foo // no copy is made
$bar = 'world'; // bar gets new memory allocated
regards,
Lukas