How to print sql query ?

how to print CDbCriteria sql ?

how to print yii execute sql query

If you create a CDbCommand based on the query you can use the ->text property I think.

if you just want to see the sql query which is executing…then you can do one thing…

1.edit your main.php config file.

  1. And add



array(

      'class'=>'CWebLogRoute',

      ),



in the db array which is present in the configuration file.

In this way a all web log will be print in the footer part of your application. This will also print a sql queries.

let it try…!!!