从Magento集合输出原始SQL查询 [英] Output raw SQL query from Magento collection

查看:37
本文介绍了从Magento集合输出原始SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下收藏,并希望在我的IDE Xdebug工具中查看原始SQL-

I have the following collection and want to view the raw SQL within my IDE Xdebug tool -

$collection = Mage::getResourceModel('rp/organisation_collection')
                ->searchByPostcodeLastname($postcode, Slastname)
                ->addFieldToSelect(array('organisation_id'))
                ->setPageSize(1);

$qry = $organisation->load()->getSelect();

这虽然显示Varien对象似乎并没有给我原始SQL供我检查-有人可以确认我做错了吗?

This while does show the Varien object doesn't seem to give me the raw SQL for me to check - can someone confirm what I am doing wrong?

推荐答案

尝试

$ collection-> getSelect()-> __ toString()

$collection->getSelect()->__toString()

请参见如何显示Magento sql查询为字符串?

这篇关于从Magento集合输出原始SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆