Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 985
Zabs Avatar asked Jan 20 '14 10:01

Zabs


1 Answers

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,
        ),
    ),
),
like image 187
Kumar V Avatar answered Oct 06 '22 01:10

Kumar V