function StatementWrapperIterator::fetch
Same name in other branches
- 10 core/lib/Drupal/Core/Database/StatementWrapperIterator.php \Drupal\Core\Database\StatementWrapperIterator::fetch()
Overrides StatementInterface::fetch
3 calls to StatementWrapperIterator::fetch()
- StatementWrapperIterator::fetchAllAssoc in core/
lib/ Drupal/ Core/ Database/ StatementWrapperIterator.php - Returns the result set as an associative array keyed by the given field.
- StatementWrapperIterator::fetchAllKeyed in core/
lib/ Drupal/ Core/ Database/ StatementWrapperIterator.php - Returns the entire result set as a single associative array.
- StatementWrapperIterator::fetchAssoc in core/
lib/ Drupal/ Core/ Database/ StatementWrapperIterator.php - Fetches the next row and returns it as an associative array.
File
-
core/
lib/ Drupal/ Core/ Database/ StatementWrapperIterator.php, line 287
Class
- StatementWrapperIterator
- StatementInterface iterator implementation.
Namespace
Drupal\Core\DatabaseCode
public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL) {
assert(!isset($mode) || in_array($mode, $this->supportedFetchModes), 'Fetch mode ' . ($this->fetchModeLiterals[$mode] ?? $mode) . ' is not supported. Use supported modes only.');
// Call \PDOStatement::fetchAll to fetch all rows.
// \PDOStatement is picky about the number of arguments in some cases so we
// need to pass the exact number of arguments we were given.
$row = match (func_num_args()) { 0 => $this->clientStatement
->fetch(),
1 => $this->clientStatement
->fetch($mode),
2 => $this->clientStatement
->fetch($mode, $cursor_orientation),
default => $this->clientStatement
->fetch($mode, $cursor_orientation, $cursor_offset),
};
if ($row === FALSE) {
$this->markResultsetFetchingComplete();
return FALSE;
}
$this->setResultsetCurrentRow($row);
return $row;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.