>
> is there an anyway to add mysql functions to the select object or I have
> to use a statement object to add them?
>
Have you tried just passing the expression as one of the arguments to from()
or join()?
$select->from("table_name", array("id", "title",
"LEFT('content',LOCATE('</P>',content))"));
The way Zend_Db_Select is supposed to work is that any column name that
contains parentheses is assumed to be an expression, and so it's not
considered an identifier and it gets no back-tick delimiters.
If that doesn't work (for example, if your expression contains no parens)
then you can instantiate a Zend_Db_Expr for the expression, and that also
signals to Zend_Db_Select that it shouldn't put that string in identifier
delimiters.
$select->from("table_name", array("id", "title",
new Zend_Db_Expr("column1 + column2")));
Regards,
Bill Karwin
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/MySQL-locate-and-left-functions-with-Zend-Db-Select-object-tp2310214p2313922.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论