574,12 → 574,21 |
* @param int $fetch_style |
* The mode that should be used for {@link PDOStatement::fetchAll()}. |
* The default is {@link PDO::FETCH_ASSOC}. |
* @return array |
* @param bool $fetchAll |
* If <code>true</code> (default), fetches all rows at once. |
* You can set this to <code>false</code> in case of memory problems, |
* in which case this function will return the prepared |
* {@link PDOStatement} instead of the result array. You can then use |
* {@link PDOStatement::fetch()} to get the returned rows iteratively. |
* <var>fetch_style</var> will be ignored then, so that you can safely |
* pass <code>null</code>, for example. |
* @return array|PDOStatement |
* @see Database::prepare() |
* @see PDOStatement::fetchAll() |
*/ |
public function select($tables, $columns = null, $where = null, |
$order = null, $limit = null, $fetch_style = \PDO::FETCH_ASSOC) |
$order = null, $limit = null, $fetch_style = \PDO::FETCH_ASSOC, |
$fetchAll = true) |
{ |
if (is_null($columns)) |
{ |
623,7 → 632,9 |
$query .= " LIMIT $limit"; |
} |
|
$stmt = $this->prepare($query); |
$stmt = ($fetchAll |
? $this->prepare($query) |
: $this->prepare($query, array(\PDO::ATTR_CURSOR => \PDO::CURSOR_SCROLL))); |
|
$params = array(); |
|
669,7 → 680,15 |
$errorInfo = $stmt->errorInfo(); |
|
$result =& $this->_lastResult; |
|
if ($fetchAll) |
{ |
$result = $stmt->fetchAll($fetch_style); |
} |
else |
{ |
$result = $stmt; |
} |
|
if (defined('DEBUG') && DEBUG > 1) |
{ |