有时为了调试magento商城系统,需要获取当前的查询sql语句
$collection->getSelectSql(true)来调试sql
magento获取SQL语句的另外一种方法是设置打印SQL为true
得到的SQL语句:
$collection->getSelectSql(true)来调试sql
1 | $collection=Mage::getResourceModel('reports/product_collection'); |
2 | $query=$collection->getSelectSql(true); |
3 | echo$query; |
1 | $collection=Mage::getResourceModel('reports/product_collection'); |
2 | $collection->printlogquery(true); |
SELECT`e`.* FROM`catalog_product_entity`
AS `e` |
http://blog.sina.com.cn/s/blog_96ae64bd0100ycg7.html
Magento SQL调试技巧
本文介绍两种在Magento中获取SQL查询语句的方法:一是通过$collection->getSelectSql(true);二是设置打印SQL为true使用$collection->printlogquery(true);这两种方法有助于开发者调试和优化Magento商城系统的数据库查询。
1566

被折叠的 条评论
为什么被折叠?



