function DatabaseStatementPrefetch::setFetchMode

See also

PDOStatement::setFetchMode()

1 call to DatabaseStatementPrefetch::setFetchMode()
DatabaseStatementPrefetch::execute in includes/database/prefetch.inc
Executes a prepared statement.

File

includes/database/prefetch.inc, line 239

Class

DatabaseStatementPrefetch
An implementation of DatabaseStatementInterface that prefetches all data.

Code

public function setFetchMode($fetchStyle, $a2 = NULL, $a3 = NULL) {
    $this->defaultFetchStyle = $fetchStyle;
    switch ($fetchStyle) {
        case PDO::FETCH_CLASS:
            $this->defaultFetchOptions['class'] = $a2;
            if ($a3) {
                $this->defaultFetchOptions['constructor_args'] = $a3;
            }
            break;
        case PDO::FETCH_COLUMN:
            $this->defaultFetchOptions['column'] = $a2;
            break;
        case PDO::FETCH_INTO:
            $this->defaultFetchOptions['object'] = $a2;
            break;
    }
    // Set the values for the next fetch.
    $this->fetchStyle = $this->defaultFetchStyle;
    $this->fetchOptions = $this->defaultFetchOptions;
}

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