How to know if query is succeded

How can I know if my query has succeeded


$user=Yii::app()->user->id;

  $command2 = Yii::app()->db->createCommand();

	$command2->update('table1', array('status'=>'2','date'=>'.date("Y-m-d H:i:s").'), 'id=:id and t_id=:rep',array(':id'=>$id,':rep'=>$user));

I want to run an if loop afterwards like if(queryrun){} else{}

The documentation cannot be more clear…

update() returns true if the update is successful

http://www.yiiframework.com/doc/api/1.1/CActiveRecord#update-detail