【发布时间】:2013-03-12 20:44:36
【问题描述】:
假设我有一个表 't' 字段 'id' int 11、'name' varchar 50 和 'description' 文本。如果文本很大,我用'description'和没有'description'查询数据库,会有什么区别吗?
以及如何在扩展 Zend_Db_Table_Abstract 类的模型中只选择“id”和“name”?
【问题讨论】:
标签: zend-framework
假设我有一个表 't' 字段 'id' int 11、'name' varchar 50 和 'description' 文本。如果文本很大,我用'description'和没有'description'查询数据库,会有什么区别吗?
以及如何在扩展 Zend_Db_Table_Abstract 类的模型中只选择“id”和“name”?
【问题讨论】:
标签: zend-framework
就性能而言,我真的帮不上什么忙,但应该不会有太大的不同。
有关如何在查询中选择字段的问题,请查看以下内容
class Model_DbTable_T extends Zend_Db_Table_Abstract{
protected $_name = 't'; // this line is optionnal if your table has the same name as the class
public function fetchSomeFields(){
$query = $this->select()
->from($this,
array('id')); // you could also include the 'as' statement in the field name to make it look like 'id as otherName'
return $this->fetchAll($query);
}
}
【讨论】: