You are here

public function DatabaseStatementPrefetch::setFetchMode in Drupal 7

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
Database interface code for engines that need complete control over their result sets. For example, SQLite will prefix some column names by the name of the table. We post-process the data, by renaming the column names using the same convention as…

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