facebook twitter hatena line google mixi email

Php/zend framework/DBモデル高速化

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

Zend_Db_TableでなくZend_Db_Selectを使うこと

$adapter = $this->getAdapter();
$select = new Zend_Db_Select($this->_db);
$cols = array('*', 'unix_timestamp'=>'UNIX_TIMESTAMP(crtm)');
$select->from($this->_schema . '.' . $this->_name, $cols);
$select->where('ul_id = ?', $ul_id);
$orderby = ($asc) ?  : ' DESC';
$select->order(array('comm_id' . $orderby));
$select->limitPage($offset, $limit);
$result = $adapter->fetchAll($select);