public StatementPrefetch::setFetchMode($mode, $a1 = NULL, $a2 = array())
Sets the default fetch mode for this statement.
See http://php.net/manual/pdo.constants.php for the definition of the constants used.
$mode: One of the PDO::FETCH_* constants.
$a1: An option depending of the fetch mode specified by $mode:
$a2: If $mode is PDO::FETCH_CLASS, the optional arguments to pass to the constructor.
Overrides StatementInterface::setFetchMode
public function setFetchMode($mode, $a1 = NULL, $a2 = array()) { $this->defaultFetchStyle = $mode; switch ($mode) { case \PDO::FETCH_CLASS: $this->defaultFetchOptions['class'] = $a1; if ($a2) { $this->defaultFetchOptions['constructor_args'] = $a2; } break; case \PDO::FETCH_COLUMN: $this->defaultFetchOptions['column'] = $a1; break; case \PDO::FETCH_INTO: $this->defaultFetchOptions['object'] = $a1; break; } // Set the values for the next fetch. $this->fetchStyle = $this->defaultFetchStyle; $this->fetchOptions = $this->defaultFetchOptions; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!StatementPrefetch.php/function/StatementPrefetch::setFetchMode/8.1.x