how to view ar sql?

Hi!

Sorry for very simple but important for me question:

I created some sophisticated query for my ar-model using

ModelName::model()->findAll…

Of course, it initially failed.  ;)

How can I see my real sql-text, generated by this command?

Thank you!

Enable logging in your configuration. You can e.g. use CWebLogRoute to get all log messages appended to every page (don't use on live site, of course!!)

<?php


    array(


        'components'=>array(


            // ... other config


            'log' => array(


                    array(


                        'class'=>'CWebLogRoute',


                    ),


                ),


            ),


            // ... other config


        )


Thank you, Mike, it's so easy and so great!

But one thing remains yet:

does some a way exist to see relations between sql and my php strings?

There are so many sql's, and it's not so easy to guess which sql-text belongs to my problem command.

Could you please create a ticket for this? I will add some trace statements in AR so that SQLs can be more easily associated with the corresponding AR commands.

created ticket #225.

But could not assign status 'enhancement', only 'defect'…

??? Sorry!