Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

how to log the low-level SQL statement with binding parameters?

with the document of phalcon->working with models->Logging Low-Level SQL Statements, I try to add an eventsManager of beforeQuery, to log the SQL statement with getSQLStatement.

But I use a binding parameter with find() method of a model. so in the log file which can't convert the bind parameters to actual value of parameter.

How can I solve this problem?

thanks!



15.1k
Accepted
answer

Hi

look here https://github.com/vpg/phalcon-debug-widget

It's a widget which listen for all requests.

I've added bindings parameter (https://github.com/vpg/phalcon-debug-widget/commit/694b58eafa01e5db3003c5f2aaf099dec29265c1) so that you can retrieve them



2.8k

thanks for your answer, I read your codes, it's excellent!! and I choose to use getSQLVariables() to get an array about the binding params.

Now I can get all the bind parmas in my log file!

Hi

look here https://github.com/vpg/phalcon-debug-widget

It's a widget which listen for all requests.

I've added bindings parameter (https://github.com/vpg/phalcon-debug-widget/commit/694b58eafa01e5db3003c5f2aaf099dec29265c1) so that you can retrieve them