Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在Lithium Framework 的CRUD中调用 MySQL 函数(如GeomFromText()或SELECT AS) ?使用database->read()很不方便(我经常更改数据库列)并且将函数包含在变量的值中只会被转义。
您是否尝试将功能放在字段选项中?
例如,我这样做:
Model::first(array( 'fields' => 'max(id)' ));
为了澄清,在您的查询中,试试这个(我没有测试过这个):
Model::first(array( 'fields' => array('field1 as myField', 'GeomFromText("POINT(x y)") as geom') ));