public function fetchAll($fetchMode = null)
{
$fetchMode = $fetchMode ?: $this->_defaultFetchMode;
$result = array();
if (PDO::FETCH_OBJ == $fetchMode) {
while ($row = $this->fetch($fetchMode)) {
$result[] = $row;
}
return $result;
}
if (!isset(self::$fetchModeMap[$fetchMode])) {
throw new \InvalidArgumentException("Invalid fetch style: " . $fetchMode);
}
if (self::$fetchModeMap[$fetchMode] === OCI_BOTH) {
while ($row = $this->fetch($fetchMode)) {
$result[] = $row;
}
} else {
$fetchStructure = OCI_FETCHSTATEMENT_BY_ROW;
if ($fetchMode == PDO::FETCH_COLUMN) {
$fetchStructure = OCI_FETCHSTATEMENT_BY_COLUMN;
}
oci_fetch_all($this->_sth, $result, 0, -1, self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS);
if ($fetchMode == PDO::FETCH_COLUMN) {
$result = $result[0];
}
}
return $result;
}