how to use CDbCommand

hello everyone, i new using yii and i want to know how i can to pass this functions to yii using the CDbCommand class




function update_clients()

{

    mysql_query( "UPDATE pageGen SET id = id + 1 LIMIT 1" );

}


function get_update()

{

    $result = mysql_query( "SELECT id FROM pageGen LIMIT 1" );

    $update = mysql_result( $result, 0, 'id' );

    return $update;

}







function update_clients()

{

  //the special update function doesn't support LIMIT so you need to do

  Yii::app()->createCommand("UPDATE pageGen SET id = id + 1 LIMIT 1")->execute();

}


function get_update()

{

    $id = Yii::app()->createCommand()

      ->select('id')

      ->from('pageGen')

      ->limit(1)

      ->queryScalar();

    

    return $id;

}