Getting the string representation from CDbCriteria

后端 未结 2 949
一向
一向 2021-01-15 02:59

Is there any way to the get the string representation of the query from CDbCriteria? For testing and debugging purposes.

2条回答
  •  盖世英雄少女心
    2021-01-15 04:06

    You can use logging and profiling configuring your main.php like this:

    'components'=>array(
        'log'=>array(
            'class'=>'CLogRouter',
            'routes'=>array(
                array(
                    'class'=>'CWebLogRoute',
                    'categories'=>'system.db.CDbCommand',
                    'showInFireBug'=>true,
                ),
            ),
        ),
        'db'=>array(
            'enableProfiling'=>true,
            'enableParamLogging'=>true,
        ),              
    ),
    

提交回复
热议问题