phpzend-frameworkzend-dbzend-db-select

Zend modification. Adding MySQL FORCE INDEX hint


I am trying to extend the Zend library in order to get queries like this one:

SELECT * FROM item i **force index(ix)** ORDER BY date LIMIT 100;

I am working arround with this Zend forum issue solution: http://framework.zend.com/issues/browse/ZF-7570

However I have a problem. Look at the code below.

$select->forceIndex('index');
echo $select->assemble();
     //  I get the right SELECT query with the force index hint
$this->fecthAll($select);
    //  The server execute a wrong SELECT query without the force index hint

Some help?


Solution

  • I am not pretty sure why, but if I remove the echo clause, fetchAll executes the right query...

    So that's the answer, remove echo