I can't find the author anymore, but this extended MySQL driver was pasted in the bin a while back (I think). Pasting it again.
http://bin.cakephp.org/view/443659159 // Extended 'resultSet' to allow alias processing // Fields should contain '((something)) AS Model__field' Hope this helps. On 15 Oct 2008, at 02:59, Dérico Filho wrote: > > Hello guys, > > > So I asked a question about having clauses using $this->Model->find() > method, and the answer was daunting, in my opinion: use in Model Class > $this->query() method within a custom method... OK. I shall do it this > way. > > One of the problems I face using $this->query() is: > > Whenever I have a special field, the result parser puts it in a > different key. > > For instance: > > $qry = $this->query("SELECT `Table`.*, `Table`.field * 1000 as > specialfield FROM ...."); > > it would return $qry as > Array( 0 => > Array("Table" => Array("field" => "1", "field2" => "value"), 0 => > Array("specialfield" => "1000"), ... > ); > > What do I do? > > I array_walk the result, array_mergin Table with 0... eventually it > turns into: > Array( 0 => > Array("Table" => Array("field" => "1", "field2" => "value", > "specialfield" => "1000"), ... > ); > > Is there any more practical way doing it? > > thanks you guys! > > []s > Dérico Filho > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
