2011-01-04 13 views
2

フィールド 'id' int 11、 'name' varchar 50、 'description'というフィールドを持つ 't'テーブルがあるとします。テキストが非常に大きく、 'description'と 'description'を付けずにデータベースを照会している場合、違いはありますか?モデルからDBテーブルの特定のフィールドを選択する方法は?

Zend_Db_Table_Abstractクラスを拡張するモデルで 'id'と 'name'のみを選択する方法はありますか?

答えて

4

私は本当に助けることはできませんが、大きな違いはありません。次

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); 
    } 
} 
でクエリを見内のフィールドを選択する方法についてのご質問については

関連する問題