zeusion
(Zeusion)
July 24, 2014, 10:45am
1
I know two ways to print SQL
1 protected/config/main.php
'log'=>array( 'class' => 'CFileLogRoute', 'levels' => 'trace', ),
2 framework/db/CDbCommand.php
#483 add echo ($this->getText())."\n\n";
1 2 ways to print
SELECT COUNT(*) FROM `fh_comment` `t` WHERE [b]hid = :hid [/b]
But that not the last sql;
Please help me where can echo the last sql,where file and where position?
Querying SQL: SELECT * FROM `fh_note` `t` WHERE hid = 0 or hid = :hid ORDER BY id desc LIMIT 1;
I want This.
Querying SQL: SELECT * FROM `fh_note` `t` WHERE hid = 0 or hid = 1 ORDER BY id desc LIMIT 1; (THE LAST SQL)
sorry,English is very poor
You got it?what I want?
3Q!
I think what you are looking for is CDbConnection.enableParamLogging .
zeusion:
I know two ways to print SQL
1 protected/config/main.php
'log'=>array( 'class' => 'CFileLogRoute', 'levels' => 'trace', ),
2 framework/db/CDbCommand.php
#483 add echo ($this->getText())."\n\n";
1 2 ways to print
SELECT COUNT(*) FROM `fh_comment` `t` WHERE [b]hid = :hid [/b]
But that not the last sql;
Please help me where can echo the last sql,where file and where position?
Querying SQL: SELECT * FROM `fh_note` `t` WHERE hid = 0 or hid = :hid ORDER BY id desc LIMIT 1;
I want This.
Querying SQL: SELECT * FROM `fh_note` `t` WHERE hid = 0 or hid = 1 ORDER BY id desc LIMIT 1; (THE LAST SQL)
sorry,English is very poor
You got it?what I want?
3Q!
Hi Zeusion!
I have a solusion, and i posted at thear, you can see it How to use CWebLogRoute to display SQL queries with params replaced into SQL