MySQL function call in lithium

How can you call a MySQL function (like GeomFromText () or SELECT AS ) in the Lithium Framework CRUD? Using database-> read () is awkward (I change database columns a lot) and including a function in a variable's value ends up being escaped.

+3


source to share


1 answer


Have you tried putting a function in a field?

For example, I do this:

Model::first(array(
    'fields' => 'max(id)'
));

      



To clarify, in your request, try this (I haven't tested this):

Model::first(array(
     'fields' => array('field1 as myField', 'GeomFromText("POINT(x y)") as geom')
));

      

+4


source







All Articles