public function StatementWrapper::fetch in Drupal 9
Fetches the next row from a result set.
See http://php.net/manual/pdo.constants.php for the definition of the constants used.
Parameters
$mode: One of the PDO::FETCH_* constants. Default to what was specified by setFetchMode().
$cursor_orientation: Not implemented in all database drivers, don't use.
$cursor_offset: Not implemented in all database drivers, don't use.
Return value
A result, formatted according to $mode.
Overrides StatementInterface::fetch
1 call to StatementWrapper::fetch()
- StatementWrapper::fetchAssoc in core/
lib/ Drupal/ Core/ Database/ StatementWrapper.php - Fetches the next row and returns it as an associative array.
File
- core/
lib/ Drupal/ Core/ Database/ StatementWrapper.php, line 265
Class
- StatementWrapper
- Implementation of StatementInterface encapsulating PDOStatement.
Namespace
Drupal\Core\DatabaseCode
public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL) {
// Call \PDOStatement::fetchAll to fetch all rows.
// \PDOStatement is picky about the number of arguments in some cases so we
// need to be pass the exact number of arguments we where given.
switch (func_num_args()) {
case 0:
return $this->clientStatement
->fetch();
case 1:
return $this->clientStatement
->fetch($mode);
case 2:
return $this->clientStatement
->fetch($mode, $cursor_orientation);
case 3:
default:
return $this->clientStatement
->fetch($mode, $cursor_orientation, $cursor_offset);
}
}