【发布时间】:2013-04-11 13:12:24
【问题描述】:
我使用在模型中使用“FORCE INDEX”的查找方法。模型很好,但是当我对该 find 方法进行测试时,发生了 SQL 错误。 我使用测试/夹具并定义数据库模式和数据。在测试/夹具中,我不知道如何定义索引。因此,用于测试的数据库没有索引。 如果您能告诉我如何在测试/夹具中定义索引,那就太好了。
在模型中...
$this->Model->find('all', array(
'fields' => array('foo'),
'conditions' => array('foo' => foo),
'joins' => array('FORCE INDEX(foo)'),
);
在测试/夹具中
var $fields = array(
'id' => ....
'foo' => ....
'created' => ....
'modified' => ....
);
【问题讨论】:
标签: php cakephp indexing cakephp-1.3