ZF-6325: Pass profiling information to all Zend Db query methods. __LINE__, __FILE__, scalar or string values for debugging and identifying line position of query


For several years we have used our own DB layer and used the typical $db->query() method, however, we adapted our class to handle the passing of line level information, for example:

$query = $db->query("SELECT * FROM table", LINE, FILE);

In our own profiler, we could see where those particular queries were executed and in what file. It is very helpful if there is a problem with your query, but it goes unnoticed until you review the profiler results. Upon changing to the Zend Db Adapter, this missing feature was a big loss for us. I considered passing the information to the $bind argument, but I don't want to neglect the availability of using parameter placeholders. Additionally that wasn't the intended use of the second argument for the Zend_Db_Statement.

I would love to hear any suggestions, or the response of a possible future inclusion of this feature.

Thank you!

A huge Zend Framework Fan Mike


You can use the PHP function debug_backtrace() for this purpose.