Set the default fetch mode for this statement

@param int $mode
@param mixed $colClassOrObj
@param array $ctorArgs

@internal param int $fetchType
@return bool
504831
public function setFetchMode(
        $mode,
        $colClassOrObj = null,
        array $ctorArgs = array()
    )
    {
        //52: $this->_statement->setFetchMode(PDO::FETCH_ASSOC);
        if ($colClassOrObj !== null || !empty($ctorArgs)) {
            throw new PDOException('Second and third parameters are not implemented for PoolPDOStatement::setFetchMode()');
            //see http://www.php.net/manual/en/pdostatement.setfetchmode.php
        }
        $this->_fetchMode = $mode;
        return true;
    }
1274671
protected function prepared( PDOStatement $statement, $fetchMode = true )
	{
		if( $fetchMode )
		{
			$statement->setFetchMode( $this->fetchMode );
		}
		if( isset( $this->events ) )
		{
			$this->events->dispatch( new Events\StatementPreparedEvent( $this, $statement ) );
		}
		return $statement;
	}
729505
public function fetch($style = null, $orientation = null, $offset = null)
    {
        set_error_handler(array($this->_pdooci,"errorHandler"));
        try {
            $style = is_null($style) ? $this->_fetch_sty : $style;
            $this->_fetch_sty = $style;
            $rst   = null;

            switch ($style)
            {
            case \PDO::FETCH_BOTH:
            case \PDO::FETCH_BOUND:
                $rst = \oci_fetch_array($this->_stmt, \OCI_BOTH + \OCI_RETURN_NULLS);
                break;
            case \PDO::FETCH_ASSOC:
                $rst = \oci_fetch_array($this->_stmt, \OCI_ASSOC + \OCI_RETURN_NULLS);
                $rst = $this->_fixResultKeys($rst);
                break;
            case \PDO::FETCH_NUM:
                $rst = \oci_fetch_array($this->_stmt, \OCI_NUM + \OCI_RETURN_NULLS);
                break;
            case \PDO::FETCH_OBJ:
                $rst = \oci_fetch_object($this->_stmt);
                break;
            }
            $this->_current = $rst;
            $this->_checkBinds();
        } catch (\Exception $e) {
            throw new \PDOException($e->getMessage());
        }
        restore_error_handler();
        return $rst;
    }
54773
public function query($fetchMode = null, $bind = array())
    {
        if (!empty($bind)) {
            $this->bind($bind);
        }

        $stmt = $this->_adapter->query($this);
        if ($fetchMode == null) {
            $fetchMode = $this->_adapter->getFetchMode();
        }
        $stmt->setFetchMode($fetchMode);
        return $stmt;
    }
551104
public function fetch($fetchType = 'assoc')
    {
        if ($fetchType === 'num') {
            return $this->statement->fetch(\PDO::FETCH_NUM);
        } elseif ($fetchType === 'assoc') {
            return $this->statement->fetch(\PDO::FETCH_ASSOC);
        } elseif ($fetchType === 'obj') {
            return $this->statement->fetch(\PDO::FETCH_OBJ);
        }
    }
287203
public static function getDb($fetchMode = \OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_NUM)
    {
        if (null === static::$db) {
            $databaseFactory = static::getInstance();
            static::$db = $databaseFactory->createDatabase();

            /** Post connect actions will be taken only once per connection */
            $databaseFactory->onPostConnect();
        }

        /** The following actions be taken on each call to getDb */
        static::$db->setFetchMode($fetchMode);

        return static::$db;
    }
329721
public function parseAll(array $data, int $fetchStyle, $fetchArgument = null, array $ctorArgs = array()): array
    {
        $result = [];
        foreach($data as $row)
        {
            switch($fetchStyle)
            {
                case \PDO::FETCH_COLUMN:
                    $item = $this->fetchParser->parseRow($row, \PDO::FETCH_BOTH);
                    $result[] = $item[$fetchArgument ?? 0] ?? null;
                    break;
                default:
                    $result[] = $this->fetchParser->parseRow($row, $fetchStyle);
                    break;
            }
        }
        return $result;
    }
1086156
public function fetch($type = \PDO::FETCH_ASSOC, $ori = null, $offset = 0)
    {
        $this->execute();

        if (!$this->cursor) {
            return false;
        }

        return $this->getCursor()->fetch($type);
    }
555324
public function fetchObject(string $className = "stdClass", array $ctorArgs = null)
    {
        return $this->statement->fetchObject($className, $ctorArgs);
    }
1302544
public function queryClass($statement, $classname, $params = array(), $ctorargs = array()) {
        $start = microtime(true);
        $q = $statement . '';
        if (is_a($statement, ModelCondition::className())){
            foreach ($statement->getJoinParams() as $k=>$v){
                $params[$k] = $v;
            }
        }
        $statement = $this->prepare($q);
        try {
            $statement->execute($params);
        } catch (\PDOException $e){
            $this->error($e->getMessage(), array(
                'File' => __FILE__,
                'Line' => __LINE__ - 4,
                'Query' => $q,
                'Params' => $params,
                'Trace' => $e->getTraceAsString()
            ));
            return null;
        }
        $objects = array();
        while ($ob = $statement->fetchObject($classname, $ctorargs)) {
            $objects[] = $ob;
        }
        $this->debug($q, array(
            'params' => $params,
            'intoClass' => $classname,
            'controllerArguments' => $ctorargs,
            'rows' => count($objects),
            'time' => microtime(true) - $start,
            'dns' => $this->dns
        ));
        return $objects;
    }
996236
public function fetch($fetchMode = null, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
    {
        // do not try fetching from the statement if it's not expected to contain result
        // in order to prevent exceptional situation
        if ($this->stmt === null || ! $this->result) {
            return false;
        }

        $args      = func_get_args();
        $fetchMode = $fetchMode ?: $this->defaultFetchMode;

        if ($fetchMode === FetchMode::COLUMN) {
            return $this->fetchColumn();
        }

        if (isset(self::$fetchMap[$fetchMode])) {
            return sqlsrv_fetch_array($this->stmt, self::$fetchMap[$fetchMode]) ?: false;
        }

        if (in_array($fetchMode, [FetchMode::STANDARD_OBJECT, FetchMode::CUSTOM_OBJECT], true)) {
            $className = $this->defaultFetchClass;
            $ctorArgs  = $this->defaultFetchClassCtorArgs;

            if (count($args) >= 2) {
                $className = $args[1];
                $ctorArgs  = $args[2] ?? [];
            }

            return sqlsrv_fetch_object($this->stmt, $className, $ctorArgs) ?: false;
        }

        throw new SQLSrvException('Fetch mode is not supported!');
    }
463066
protected function _fetch_row($result, $mode)
    {
        if ($result || ($result === null && ($result = $this->last_result))) {
            return oci_fetch_array($result, $mode + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
        }

        return false;
    }
683843
public function asObject(string $className, array $constructorArgs = []): QueryBuilderHandler
    {
        return $this->setFetchMode(PDO::FETCH_CLASS, $className, $constructorArgs);
    }
349281
public function select($query, array $params = [], $fetchMode = null)
    {
        // Execute query
        $stmt = $this->connection->prepare($query);
        $stmt->execute($params);
        if ($fetchMode !== null) {
            $stmt->setFetchMode($fetchMode);
        }
        return $stmt->fetchAll();
    }
997085
private function instantiate($model, $ctorArgs) {
		if (is_object($model)) {
			$className = get_class($model);
		} else {
			$className = $model;
		}
		$companionName = $this->getCompanionName($className);

		$psr4Prefix = $this->target->getPrefix()->rtrim('\\');
		if (!empty($psr4Prefix)) {
			$companionName = $psr4Prefix->join($companionName, '\\');
		}

		// Need to explicitely cast to string to avoid attempting to instantiate
		// another instance of zpt\util\String
		$companionName = (string) $companionName;

		$instance = new $companionName($ctorArgs);

		if ($instance instanceof CompanionAwareInterface) {
			$instance->setCompanionLoaderFactory($this->factory);
		}

		return $instance;
	}
581012
public function fetchAllObject(string $className = 'stdClass', array $constructorArgs = []):  ? array
    {
        $r = $this->DriverStatement->fetchAll(PDO::FETCH_CLASS, $className, $constructorArgs);
        return $r ?: null;
    }
190999
private function getFetchMode($className, $fetchMode)
    {
        $fetchMode = strtoupper($fetchMode);
        if (!defined('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $fetchMode)) {
            throw ORM\MappingException::invalidFetchMode($className, $fetchMode);
        }

        return constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . $fetchMode);
    }