代码如下,我的目标是使用 Pdo_mysql:
use \Zend\Db\Adapter\Adapter;
use \Zend\Db\Sql\Sql;
use \Zend\Db\Sql\Expression;
$params = array(
'driver' => "Pdo_mysql",
'host' => &$this->Registry->config[ 'sql' ][ 'host' ],
'username' => &$this->Registry->config[ 'sql' ][ 'user' ],
'password' => &$this->Registry->config[ 'sql' ][ 'passwd' ],
'dbname' => &$this->Registry->config[ 'sql' ][ 'dbname' ]
);
$this->adapter = new \Zend\Db\Adapter\Adapter( $params );
$this->platform = $this->adapter->getPlatform();
$this->sql = new Sql( $this->adapter );
当我检查标识符引用符号时:
print $this->platform->getQuoteIdentifierSymbol(); // Output: "
如您所见,双引号是符号。这当然会使我的所有 MySQL 查询无效,因为它用双引号 (") 而不是正引号 (`) 引用所有标识符名称(表、列等)。
那么,为什么 PDO-MySQL 驱动程序使用 Sql92 符号来代替呢?以及如何解决这个问题?