I can't express Question well in English
You know my English is poor.
That's not the point
When I use getQueryLog() to get the last executed query.
But I get the response
[query] => select * from table where`teacher_oid` = ? and `class_oid` = ?
[bindings] => Array
(
[0] => 'tid'
[1] => 'cid'
)
[time] => 12.58
Is there a way automatically written bindings[0] to first "?" bindings[1] to second "?" ?
Thank you!
Nope. Unfortunately there is not. This is a limitation of PHP's PDO.
However you can still find the final query.
I accomplish this by enabling MySQL's query logging in /etc/mysql/my.cnf
(The location of your mysql configuration file may be different).
You want to enable the general_log
inside of my.cnf
and then restart MySQL. Then in /var/log/mysql.log
, you'll see each query made to the database.
Only do this in a development server, not in production.