将 FORCE INDEX 与 zend 结合使用
我尝试找到如何将以下 MySQL 查询转换为 Zend Db Table Select:
SELECT ColA,ColB,ColC
FROM MyTable
FORCE INDEX(ColA,ColB)
WHERE ColA = 'val0002'
AND ColB = 'val0045'
我尝试使用类似这样的内容:
$select = $dbTable->select()
->from('MyTable',array('ColA','ColB')
->forceIndex(array('ColA','ColB'))
->where("ColA = 'val0002'")
->where("ColB = 'val0045'");
我在论坛中找到了“forceIndex(array('ColA','ColB'))”,但它没有工作:(
谢谢你帮助我:)
I try to find how to translate the following MySQL query into Zend Db Table Select:
SELECT ColA,ColB,ColC
FROM MyTable
FORCE INDEX(ColA,ColB)
WHERE ColA = 'val0002'
AND ColB = 'val0045'
i try to use something like this:
$select = $dbTable->select()
->from('MyTable',array('ColA','ColB')
->forceIndex(array('ColA','ColB'))
->where("ColA = 'val0002'")
->where("ColB = 'val0045'");
I found " forceIndex(array('ColA','ColB')) " in a forum, but it does not work :(
and thank you for helping me :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为
Zend_Db_Select
还不支持它。这里似乎有一个关于它的改进请求: http://framework.zend.com/ issues/browse/ZF-7570(报告评论包含一些可能对您有用的代码链接)。
希望有帮助,
I think
Zend_Db_Select
doesn't support it yet. There seems to be an improvement request about it here: http://framework.zend.com/issues/browse/ZF-7570(The report comments contain some links to code that could be useful to you).
Hope that helps,
这是一个可以帮助对该问题感兴趣的解决方案:
http://pastie.org/1354770
我们可以将以下两个方法添加到 zend 类“Zend_Db”中。我希望它能帮助你,就像它帮助我一样(但部分)。
here's a solution that can help interested by the problem :
http://pastie.org/1354770
we can add the following two methods to the zend class "Zend_Db". I hope it will help you as it helped me (but partially).