Debug queries

I’m running a query like this

 $sql = "REPLACE INTO accommodations SET


         WHERE id =:id"; 

$connection = Yii::app()->db;

$command = $connection->createCommand($sql);

$command->bindParam(":id", $row["Id"], PDO::PARAM_INT);

$command->bindParam(":city_id", $row["ParentId"], PDO::PARAM_INT);


I’d like to output the generated query before it is executed, so I’m sure all the values are properly binded…

How do I do that? I know it’s possible to use logging when it executes, but I’m just looking for a quick way to show the query. Is there a method for it?

This the link

Which i am following for debugging a sql quires and i will also recommend it to you.So,Kindly check this link.

Thanks, but I know how to get the executed query from the log, it would be much quicker if I could just display the rendered query on the page itself before it is executed.