我要更改受保护的$ _autoQuoteIdentifiers的值,但我不知道如何。
class ZendX_Db_Adapter_Firebird extends Zend_Db_Adapter_Abstract
{
protected $_autoQuoteIdentifiers = true;
.
.
.
好的,我可以在课堂上直接更改它,但这不是最好的方法。
我的application.ini是:
resources.db.adapter = Firebird
resources.db.params.dbname = "/tmp/test.fdb"
resources.db.params.host = "127.0.0.1"
resources.db.params.username = sysdba
resources.db.params.password = masterkey
resources.db.params.adapterNamespace = "ZendX_Db_Adapter"
我的Bootstrap.php是:
protected function _initDatabase()
{
$this->bootstrap('db');
$db = $this->getResource('db');
$db->setFetchMode(Zend_Db::FETCH_OBJ);
Zend_Registry::set('db', $db);
Zend_Db_Table_Abstract::setDefaultAdapter(Zend_Registry::get('db'));
}
有什么想法吗?
答案 0 :(得分:2)
Zend参考指南给出了答案:Reference Guide
$options = array(
Zend_Db::AUTO_QUOTE_IDENTIFIERS => false
);
$params = array(
'host' => '127.0.0.1',
'username' => 'webuser',
'password' => 'xxxxxxxx',
'dbname' => 'test',
'options' => $options
);
$db = Zend_Db::factory('Firebird', $params);
答案 1 :(得分:0)
使用您自己的一个扩展Firebird类,并设置适配器以代替“My_Firebird”(或其他)。您可以在类中更改属性(甚至可以通过传入的配置对它们进行配置)。
答案 2 :(得分:0)
您确定无法在适配器上拨打$this->setAutoQuoteIdentifiers(false)
吗? :)