Make use of the parameters listed here:

http://api.cakephp.org/class_model.html#63ade7d3c6d03c83ab53a224e23ad9dd

(conditions,fields,recursive)
so you only request the stuff you need

On May 31, 1:25 pm, StinkyTofu <[EMAIL PROTECTED]> wrote:
> I am calling $this->Member->findAll(null, 'Member.id') on a database
> of 8000 records and am receiving the following error:
>
> Allowed memory size of 16777216 bytes exhausted (tried to allocate 782
> bytes) in /home/web88/html/cake/libs/model/datasources/dbo_source.php
> on line 312
>
> I assume this error is happening because the server is loading too
> many records into the array.  The issue here is that I need to take
> all the member records and insert them into a .csv file, so I cannot
> use the SQL 'LIMIT' function as that will mean that only a portion of
> the records will be imported into the csv.
>
> Just wondering if I am taking the right approach here or if there is a
> function in CakePHP which will allow me to load one record at a time
> and then iterate through the records in the database to avoid loading
> all the records into one array at a time?  If not, is there a best
> practice in CakePHP to deal with this kind of problem?  I was thinking
> of using a for next loop in combination with findAll() using the SQL
> 'LIMIT' function to keep the returned records to a limit of 50, and
> then looping through the database this way until all the records have
> been processed.  I just wasn't sure if this is the right approach to
> take, it seems like a messy work-around. Is there a simpler approach
> that I've completely overlooked?
>
> Thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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