1.20.x prefetch.inc public DatabaseStatementPrefetch::setFetchMode($fetchStyle, $a2 = NULL, $a3 = NULL)

See also

PDOStatement::setFetchMode()

File

includes/database/prefetch.inc, line 236
Database interface code for engines that need complete control over their result sets.

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