Re: DB_DataObject fetch methods
| From: | Alex Hayes | Date: | Wed, 10 Mar 2004 23:34:52 +0000 |
| Subject: | Re: DB_DataObject fetch methods | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-26273@lists.php.net to get a copy of this message | ||
Yes, you are correct. However I believe this would be know different to the
way in which DB works i believe.
There are definetely times when it is not viable to do it in this way,
however, there are times when it makes things alot easier and alot more
straightforward to do it in this manner.
alex
"Ian Eure" <ieure@php.net> wrote in message
news:200403101143.49764.ieure@php.net...
> 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.