/** * ステートメントの実行 * * ステートメントを実行して結果値を取得する。<br/> * 抽出条件が下記の条件に該当する場合に実行される * - {@link Cascade_DB_SQL_Criteria::TYPE_IS_MGET} * * @return mixed 実行結果 */ protected function fetchResultForMultiGet() { // 結果データを構築 $result = array(); $driver = $this->getDriver(); $primary_key = $this->data_format->getPrimaryKey(); $fetch_key = $this->data_format->getFetchKey(); $fetch_mode = $this->data_format->getFetchMode(); if ($this->data_format->isUseFetchKey() === FALSE) { // 主キーを使用した場合 $result = $this->fetchResultForFind(); } else { // データ取得キーを使用した場合 $result = $idx_map = array(); while ($record = $driver->fetch($fetch_mode)) { $idx_01 = $this->getResultIndex($primary_key, $record); $idx_02 = $this->getResultIndex($fetch_key, $record); switch ($fetch_mode) { case self::FETCH_MODE_NUM: $num = isset($idx_map[$idx_02]) ? $idx_map[$idx_02] : ($idx_map[$idx_02] = count($idx_map)); $result[$num][] = array_values($record); break; case self::FETCH_MODE_ASSOC: if ($idx_01 === NULL) { $result[$idx_02][] = $record; } else { $result[$idx_02][$idx_01] = $record; } break; default: $ex_msg = 'Unsupported fetch_mode {df, fetch_mode} %s %d'; $ex_msg = sprintf($ex_msg, get_class($this->data_format, $fetch_mode)); throw new Cascade_Exception_DBException($ex_msg); } } } return $result; }