本文介绍了在 Zend 中使用 FORCE INDEX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试找出如何将以下 MySQL 查询转换为 Zend Db 表选择:

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'");

我在论坛中发现了"forceIndex(array('ColA','ColB')) ",但它不起作用:(

I found " forceIndex(array('ColA','ColB')) " in a forum, but it does not work :(

谢谢你帮助我 :)

推荐答案

我认为 Zend_Db_Select 尚不支持它.这里似乎有一个改进请求:http://framework.zend.com/问题/浏览/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).

希望有所帮助,

这篇关于在 Zend 中使用 FORCE INDEX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:30