2013-03-19 17 views
7

所以我已經升級到2.1.4 ZF,我用公告稱招呼:Attempting to quote a value in Zend\Db\Adapter\Platform\Mysql without extension/driver support can introduce security vulnerabilities in a production environment在ZF引用一個值的SQL查詢2.1.4

我將對DBAdapter被實例化這樣:

return array(
    'service_manager' => array(
    'factories' => array(
     'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory', 
    ) 
    ), 
    'db' => array(
    'driver'   => 'pdo_mysql', 
    'driver_options' => array(
     PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'" 
    ), 
    'dsn'   => 'mysql:dbname=test;host=192.168.1.8', 
    'username'  => 'test', 
    'password'  => 'test', 
    ) 
); 

我想引述如下:

$order = 'field(ce.id, ' . $this->_db->getPlatform()->quoteValueList($ids) . ')'; 
$select->order(new Expression($order)); 

我應該怎樣做呢?我的印象是pdo_mysql有驅動程序支持引用值。

+1

可能重複 - > http://stackoverflow.com/問題/ 15476109/zend-framework-2-subqueries – Crisp 2013-03-19 16:10:07

+1

@Crisp謝謝,這對我有很大的幫助。在Zend \ Db \ Adapter的getPlatform上添加'$ this-> platform-> setDriver($ this-> getDriver());'強制它工作。但它是一個錯誤。 – mobius 2013-03-19 16:22:59

回答