在 Zend 中,如何正确打印 mysql 查询? [英] In zend, how to print a mysql query properly?
本文介绍了在 Zend 中,如何正确打印 mysql 查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能的重复:
如何在 zend 框架中打印精确的 sql 查询?
在 Zend Profiler 中,我只能打印带问号的查询 (getQuery) 或打印参数数组 (getQueryParams).
In zend profiler, I can only either print the query with question markers (getQuery) or print the parameter array (getQueryParams).
有没有办法替换所有的问号,并打印真正的sql查询?
Is there a way to replace all question markers, and print the real sql query?
谢谢!
推荐答案
这样的事情应该可行:
$profile = $this->getQueryProfile($queryId);
$query = $profile->getQuery();
$params = $profile->getQueryParams();
foreach ($params as $par) {
$query = preg_replace('/\\?/', "'" . $par . "'", $query, 1);
}
这篇关于在 Zend 中,如何正确打印 mysql 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文