CDbExpression usage

Besides using CDbExpression for getting current date time (i.e. new CDbExpression(‘NOW()’); ),

is there any other scenarios CDbExpression can be useful ?

Maybe to call any other database function? ;) Or to refer other table fields when using updateAll() for example…




$model->updateAll(array('field1'=>new CDbExpression('field2*RAND()+1')));



Hi,

you can use this

http://www.yiiframework.com/doc/api/1.1/CTimestampBehavior

hope it will be done.