function PdoResult::fetch
Fetches the next row.
Parameters
\Drupal\Core\Database\Statement\FetchAs $mode: One of the cases of the FetchAs enum.
array{class?: class-string, constructor_args?: list<mixed>, column?: int, cursor_orientation?: int, cursor_offset?: int} $fetchOptions: An array of fetch options.
Return value
array|object|int|float|string|bool|null A result, formatted according to $mode, or FALSE on failure.
Overrides ResultBase::fetch
File
-
core/
lib/ Drupal/ Core/ Database/ Statement/ PdoResult.php, line 66
Class
- PdoResult
- Class for PDO-provided results of a data query language (DQL) statement.
Namespace
Drupal\Core\Database\StatementCode
public function fetch(FetchAs $mode, array $fetchOptions) : array|object|int|float|string|bool|null {
if (!empty($fetchOptions)) {
$this->setFetchMode($mode, $fetchOptions);
}
if (isset($fetchOptions['cursor_orientation'])) {
if (isset($fetchOptions['cursor_offset'])) {
return $this->clientFetch($mode, $fetchOptions['cursor_orientation'], $fetchOptions['cursor_offset']);
}
return $this->clientFetch($mode, $fetchOptions['cursor_orientation']);
}
return $this->clientFetch($mode);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.