How to print the executed sql string from active record ?

(Ct) #1

Hi guys, I have seen here somewhere about printing the executed sql from an active record, but I think I’ve lost it, searched but can’t find it. So, please how do I return the sql string executed from ActiveRecord ?


(Mh) #2

The easiest is to active CWebLogRoute. It adds debugging output to the bottom of every page.

You can also set enableParamLogging=>true in your db component configuration.

(Ct) #3

Hey Mike, thanks, that I knew. I guess, I want to hear the hardest one ? ???

(Shopper) #4

What about within phpunit test scripts when you want to print it to the console or display in some other way?