我正在使用下一條指令從我的數據庫中獲取一些寄存器。Zend數據庫查詢結果將列值轉換爲空
(從PARAMS模塊)創建所需的模型:
$obj_paramtype_model = new Params_Model_DbTable_Paramtype();
$obj_param_model = new Params_Model_DbTable_Param();
從數據庫
// This returns a Zend_Db_Table_Row_Abstract class object
$obj_paramtype = $obj_paramtype_model->getParamtypeByValue('available_locales');
// This is a query used to add conditions to the next sentence. This is executed from the Params_Model_DbTable_Param instance class, that depends from Params_Model_DbTable_Paramtype class (reference map and dependentTables arrays are fine in both classes)
$obj_select = $this->select()->where('deleted_at IS NULL')->order('name');
// Execute the next query, applying the select restrictions. This returns a Zend_Db_Table_Rowset_Abstract class object. This means "Find Params by Paramtype"
$obj_params_rowset = $obj_paramtype->findDependentRowset('Params_Model_DbTable_Param', 'Paramtype', $obj_paramtype);
// Here the firebug log displays the queries....
Zend_Registry::get('log')->debug($obj_params_rowset);
我從Zend的所有我的數據庫執行探查獲取可用的語言環境。此時日誌和分析器對象(包括Firebug編寫器)顯示執行的SQL查詢,最後一行顯示生成的Zend_Db_Table_Rowset_Abstract類對象。如果我在某個MySQL客戶端執行SQL查詢,結果如預期。但是,Zend Firebug日誌編寫器顯示爲帶有拉丁字符( - )的列值爲NULL。
換句話說,外部SQL客戶端顯示 es_CO | Españolde Colombia and en_US |美國英語,但Zend的查詢結果顯示(並返回)es_CO | null和en_US |美國英語。
我從西班牙語哥倫比亞刪除ñ性格和查詢結果就好了,我的Zend登錄Firebug的屏幕,並在最後的Zend表單元素。
MySQL數據庫,表和列使用UTF-8-utf8_unicode_ci整理。我所有的zend框架頁面都是UTF-8字符集。我在Windows 7旗艦版上使用XAMPP 1.7.1(PHP 5.2.9,Apache在端口90和MySQL 5.1.33社區); Zend Framework 1.10.1。
對不起,如果有這麼多的信息,但我不知道爲什麼會發生這種情況,所以我儘量提供儘可能多的相關信息,以幫助我找到答案。
我很快就找不到任何答案,所以我決定使用Doctrine作爲我的Zend Framework DB ORM。但是這個答案看起來很好。我要創建另一個項目來測試它,我會回來對您的答案進行更多評論。如果這解決了這個問題,我會將這個答案標記爲那個。非常感謝你的幫助,祝你有個愉快的一天。 – 2010-03-13 13:29:50