Retrieve (or simulate) full query from PDO prepared statement

DiomyDayday

New Member
I stumbled upon this question from two years ago. \[quote\] Is there a way to get the raw SQL string executed when calling PDOStatement::execute() on a prepared statement? For debugging purposes this would be extremely useful.\[/quote\]The winning answer states that\[quote\] [...] You can also get what you want if you set the PDO attribute PDO::ATTR_EMULATE_PREPARES. In this mode, PDO interpolate parameters into the SQL query and sends the whole query when you execute().\[/quote\]But it doesn't mention how to get the resulting query string. I know it's a bad idea performance wise but that doesn't bother me in debug mode. Does anybody know how to do this?PS If there is some way I could have reopened / drawn attention to the original two year old topic instead of opening a new one, please let me know.
 
Back
Top