function StatementWrapper::fetch

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/StatementWrapper.php \Drupal\Core\Database\StatementWrapper::fetch()

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 239

Class

StatementWrapper
Implementation of StatementInterface encapsulating PDOStatement.

Namespace

Drupal\Core\Database

Code

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);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.