MySql functions and Active Record

Hello, everybody.

Is it possiblle to use MySql functions (for example STR_TO_DATE(str,format)) within CActiveRecord object?


You can do this:

$user = User::model()->findByPk(1);

$user->someDate = new CDbExpression("ANY VALID SQL COMMAND");


Y!!, thank you for your quick reply.

It works greate. :)

No problem. You may also bind params for security reasons.

new CDbExpression("MD5(:example)", array(':example' => $example));