First off, I would seriously look at redesign. Cake doesn't tend to
play nicely if you don't follow its conventions.

That said, what you're after is sort of possible. One way to achieve
it would be use multiple database configurations (a separate one for
your outer query). AFAIK this will cause cake to make an additional
database connection, and therefore maintain a second connection
pointer.

On the downside, PHP (not cake) will probably get in your way, if you
try and use pconnect, or set persistent connections in the ini file. I
have a vague memory of reading something somewhere in the mysqlclient
lib that will also try and get in the way of this sort of thing, by
simply handing you a pointer to an existing connection if you try
multiple identical connections with pconnect.

There have been more than enough discussions of late about dealing
with large result sets in cake, I suggest a big back through the last
few weeks' discussions on this one too.

Simon
http://www.simonellistonball.com/

On Apr 9, 8:19 am, holsen <[EMAIL PROTECTED]> wrote:
> Being forced into using Cake I'm trying to find out how to avoid
> getting a custom query result returned as a complete array set at once
> (seems to be the case with query()) - which will not scale for large
> datasets where the array and all the internal loops are too heavy in
> both memory and cpu usage.
>
> I have tried skimming through some of the Cake framework code and can
> see that something like rawQuery and fetchRow looks more like what I
> want. Something along this
>
> $db = ConnectionManager::getDataSource($this->useDbConfig);
>
> $res = $db->rawQuery($sql);
>
> while ($row = $db->fetchRow()) {
> ...
>
> }
>
> But... When I then do other cake queries inside the while outer loop,
> then the $db result set gets overridden, so it's not the right way.
>
> So the question is - how do I do an effective outer result loop while
> still doing inner loop queries not overriding outer loop?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to