【发布时间】:2011-01-19 18:05:46
【问题描述】:
我正在使用接下来的指令从我的数据库中获取一些寄存器。
创建所需的模型(来自 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ñol de Colombia 和 zh_CN |美国英语,但 Zend 的查询结果显示(并返回)es_CO | null 和 zh_CN |美国英语。
我从 Español de Colombia 中删除了 ñ 字符,查询结果在我的 Zend Log Firebug 屏幕和最终的 Zend Form 元素中都很好。
MySQL 数据库、表和列采用 UTF-8 - utf8_unicode_ci 排序规则。我所有的 zend 框架页面都是 UTF-8 字符集。我正在使用在 Windows 7 Ultimate 上运行的 XAMPP 1.7.1(PHP 5.2.9、Apache 端口 90 和 MySQL 5.1.33-community); Zend 框架 1.10.1。
如果有这么多信息,我很抱歉,但我真的不知道为什么会发生这种情况,所以我尝试提供尽可能多的相关信息以帮助找到一些答案。
【问题讨论】:
标签: zend-framework null zend-db-table rowset latin