We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

debug sql query

Hi all,

I want to debug an sql query.

That means to be able inspect the expanded sql query after all parameters have been bound!

Is that possible using query builder and how?

you could try using QueryLogger component from incubator 1.3.0 branch, might work for you ...

https://github.com/phalcon/incubator/tree/1.3.0/Library/Phalcon/Db/Profiler#querylogger

I know you asked about the query builder, but in my experience, it's much easier to just turn on query logging on your database, then just watch the log file.

digitronic I downloaded your component but probably I should place it somewhere so it can be autoloaded?

Right now I placed it in app/library/Db/Profiler but I still get error class not found!

Please help and thanks in advance!