Calling MySQL functions in Lithium

Go To


How it's possible to call MySQL function (like GeomFromText() or SELECT AS) in the Lithium Framework's CRUD? Using database->read() is to inconvenient (I often change the database columns) and including the function in the variable's value only ends up being escaped.

2012-04-03 20:17
by drelkata


Have you tried putting the function in the fields option?

For example, I do this:

    'fields' => 'max(id)'

To clarify, in your query, try this (i have not tested this):

     'fields' => array('field1 as myField', 'GeomFromText("POINT(x y)") as geom')
2012-04-03 22:07
by ton.yeung
No, thanks for the advice! How do make a SELECT AS or GEOMFROMTEXT query, then - drelkata 2012-04-05 12:55
@drelkata I've added what I think might work - ton.yeung 2012-04-05 16:32