user2024300
user2024300

Reputation: 169

Get finnaly sql string in Yii

I try get compile sql string, created by CdbCriteria, using config:

array(
...
   'db' => array(
...
      'enableProfiling' => true,
      'enableParamLogging' => true,
   ),
...
   'log' => array(
      'class' => 'CLogRouter',
      'routes' => array(
         array(
            'class' => 'CProfileLogRoute',
            'levels' => 'profile',
            'enabled' => true,
         ),
...

But in log i don't get finnaly sql query, just string like

system.db.CDbCommand.query(SELECT * FROM `tourn` `t` WHERE (:tournId > 0 AND id = :tournId) AND (:userId > 0 AND user_id = :userId) LIMIT 1. Bound with :tournId='1 OR TRUE', :userId='1')

How can i get compiled query? With already replaced parameters placeholder.

Upvotes: 0

Views: 1052

Answers (1)

themroc
themroc

Reputation: 88

The extension Yii-Debug-Toolbar provides you with all SQL queries for each request: http://www.yiiframework.com/extension/yii-debug-toolbar/

Upvotes: 1

Related Questions