Commit bd4d12b1 authored by Laurent's avatar Laurent
Browse files

use mysqlnd get_result / fetch_all to avoid thousands of php calls

parent 5aa5e6dc
......@@ -272,6 +272,42 @@ class Zend_Db_Statement_Mysqli extends Zend_Db_Statement
}
/**
* Returns an array containing all of the result set rows.
*
* @param int $style OPTIONAL Fetch mode.
* @param int $col OPTIONAL Column number, if fetch mode is by column.
* @return array Collection of rows, each in a format by the fetch mode.
*/
public function fetchAll($style = null, $col = null)
{
if ($style !== Zend_Db::FETCH_COLUMN) {
$this->_stmt->execute();
return $this->_stmt
->get_result()
->fetch_all($style === Zend_Db::FETCH_NUM ? MYSQLI_NUM : MYSQLI_ASSOC);
}
$data = array();
if ($style === Zend_Db::FETCH_COLUMN && $col === null) {
$col = 0;
}
if ($col === null) {
while ($row = $this->fetch($style)) {
$data[] = $row;
}
} else {
while ($val = $this->fetchColumn($col)) {
$data[] = $val;
}
}
return $data;
}
/**
* Fetches a row from the result set.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment