function Statement::setFetchMode

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Statement.php \Drupal\Core\Database\Statement::setFetchMode()

Overrides StatementInterface::setFetchMode

4 calls to Statement::setFetchMode()
Statement::execute in core/lib/Drupal/Core/Database/Statement.php
Executes a prepared statement.
Statement::fetchAllAssoc in core/lib/Drupal/Core/Database/Statement.php
Returns the result set as an associative array keyed by the given field.
Statement::fetchAllKeyed in core/lib/Drupal/Core/Database/Statement.php
Returns the entire result set as a single associative array.
Statement::__construct in core/lib/Drupal/Core/Database/Statement.php

File

core/lib/Drupal/Core/Database/Statement.php, line 164

Class

Statement
Default implementation of StatementInterface.

Namespace

Drupal\Core\Database

Code

public function setFetchMode($mode, $a1 = NULL, $a2 = []) {
    // Call \PDOStatement::setFetchMode to set fetch mode.
    // \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 1:
            return parent::setFetchMode($mode);
        case 2:
            return parent::setFetchMode($mode, $a1);
        case 3:
        default:
            return parent::setFetchMode($mode, $a1, $a2);
    }
}

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