Re: DB_DataObject fetch methods
| From: | Ian Eure | Date: | Wed, 10 Mar 2004 19:43:49 +0000 |
| Subject: | Re: DB_DataObject fetch methods | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-26257@lists.php.net to get a copy of this message | ||
On Tuesday 09 March 2004 07:06 pm, Alex Hayes wrote:
> Ok.. perhaps I am missing the point (wouldnt be the first time ;) However,
> is there a way, or has someone written an extension that will allow some to
> do the following:
>
> (snip)
>
AFAIK, you're correct. However, what you want to do isn't such a great idea,
since you incur a significant overhead vs the while-loop. E.g. if you have
100 rows in your table, you will have to instantiate 100 DataObjects, vs 1
for the while method. This uses a non-trivial amount of RAM and CPU, and
you'll end up having to jack up PHP's memory limit to avoid killing the
script.
But if that's really what you want to do, the function you wrote will do the
trick. You can just add it to a class that extends DB_DataObject, and have
your DOs extend it. The selectAdd()/selectAdd('*') are unnecessary, btw,
DB_DataObject defaults to selecting all rows in the table.