是否可以在 Magento 中显示所有查询字符串?我真的很想看看执行了哪些查询.
Is it possible to display all the query strings in Magento? I really like to see what queries are executed.
谢谢
我不是 100% 确定这会捕获每个查询,但大多数通过查询方法运行 Zend_Db_Adapter_Abstract query 方法在
I'm not 100% sure this will catch every query, but most run through the query method Zend_Db_Adapter_Abstract query method in
lib/Zend/Db/Adapter/Abstract.php
考虑到这一点,您可以临时添加一些调试语句(为了安全起见,添加到您在 app/code/local/Mage 中制作的副本中)
With that in mind, you could temporarily add some debugging statements (to a copy you make in app/code/local/Mage to be safe)
public function query($sql, $bind = array())
{
// connect to the database if needed
$this->_connect();
// is the $sql a Zend_Db_Select object?
if ($sql instanceof Zend_Db_Select) {
if (empty($bind)) {
$bind = $sql->getBind();
}
$sql = $sql->assemble();
}
echo "{$sql}
<br />
";
var_dump($bind);
如果您需要全部捕获它们,最好在 MySQL 级别执行此操作(根据您的主机/IT 情况,这并不总是可行)
If you need to catch them all, you'd be better off doing this at the MySQL level (which isn't always possible depending on your host/IT situation)
这篇关于如何在 Magento 中打印所有查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
覆盖 Magento 配置Override Magento Config(覆盖 Magento 配置)
什么会导致 print_r 和/或 var_dump 调试变量失败?What would cause a print_r and/or a var_dump to fail debugging a variable?(什么会导致 print_r 和/或 var_dump 调试变量失败?)
如何在 magento 中以编程方式更新自定义选项?How to update custom options programatically in magento?(如何在 magento 中以编程方式更新自定义选项?)
管理页面上的 Magento 404Magento 404 on Admin Page(管理页面上的 Magento 404)
Magento - 从订单中获取价格规则Magento - get price rules from order(Magento - 从订单中获取价格规则)
Magento 更改产品页面标题以包含属性Magento Change Product Page Titles to Include Attributes(Magento 更改产品页面标题以包含属性)