-- whisher <[email protected]> wrote
(on Friday, 10 December 2010, 11:56 AM -0800):
> Thanks for the reply.
> 
> [of 100k+ items, you're likely doing something wrong anyways]
> 
> so I have to do a heavy query 
> I can't use limit and you know I've to do the query :)
> I avoid memory leak getting the cursor like that
> 
> $data = array();
> $db = Zend_Registry::get('db');
> $stmt = $db->query($query);
> while ($row = $stmt->fetch()) {
>     $data[] = $row;
> }
> // $content =  Zend_Json::encode($data);
> 
> I don't think to do someting wrong imho
> if you know a better approach well
> I'll be very pleased to know it :)

In your case, ask the following questions:

 * Do I have JS lambdas in the rows being returned?
 * Are my rows in something other than UTF-8?

If the answer to both is "no", just use json_encode().

-- 
Matthew Weier O'Phinney
Project Lead            | [email protected]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Reply via email to