代碼是作爲以下內容,其中我的目標是使用PDO_MYSQL:ZF2 - Zend的 DB 適配器平臺:: getQuoteIdentifierSymbol()
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查詢無效,因爲它會用雙引號(「)而不是正向引號(`)引用所有標識符名稱(表格,列等)。 Sql92符號代替嗎?以及如何修復?
爲什麼「新Sql」語句,你應該準備和從$ t執行查詢他的 - >適配器 – Ashley 2013-04-08 12:15:22
他們都有自己的用途,阿什利。 – 2013-04-09 06:34:21