Zabs
Zabs

Reputation: 14142

Yii - echo the last query

I have used Codeigniter before and it has a feature that will echo the last database query - really useful for debugging.

eg...

$this->getSomeData->findAll();
Yii command to output this single query e.g SELECT * FROM TABLE...

Does Yii have a similar feature to simply show the very last query executed?

Upvotes: 6

Views: 6470

Answers (1)

Kumar V
Kumar V

Reputation: 8830

Try this in your config file. You can see the query and other details at the bottom of the page.

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

Upvotes: 10

Related Questions