@param int $fetchMode

@throws ConnectionException
767300
public function setFetchMode($fetchMode = Connection::FETCH_ASSOC)
    {
        if (!($fetchMode & (Connection::FETCH_ASSOC | Connection::FETCH_OBJ))) {
            throw new ConnectionException('Invalid fetch mode passed');
        }
        
        $this->fetchMode = $fetchMode;
    }
206011
public function setFetchMode($fetch)
    {
        $this->fetch = $fetch;

        $this->pdo->setAttribute(
            PDO::ATTR_DEFAULT_FETCH_MODE,
            $fetch
        );
    }
1178373
public function fetchAll($sql, $bind = [], $fetchMode = \PDO::FETCH_ASSOC, $useMaster = false)
    {
        $context = $this->_context;

        $context->sql = $sql;
        $context->bind = $bind;
        $context->affected_rows = 0;

        $this->eventsManager->fireEvent('db:beforeQuery', $this);

        if ($context->connection) {
            $type = null;
            $connection = $context->connection;
        } else {
            $type = $this->_has_slave ? 'slave' : 'default';
            $connection = $this->poolManager->pop($this, $this->_timeout, $type);
        }

        try {
            $start_time = microtime(true);
            $result = $connection->query($sql, $bind, $fetchMode, $useMaster);
            $elapsed = round(microtime(true) - $start_time, 3);
        } finally {
            if ($type) {
                $this->poolManager->push($this, $connection, $type);
            }
        }

        $count = $context->affected_rows = count($result);

        $event_data = compact('elapsed', 'count', 'sql', 'bind', 'result');

        $this->logger->debug($event_data, 'db.query');

        $this->eventsManager->fireEvent('db:afterQuery', $this, $event_data);

        return $result;
    }
1319639
private function connect($selectDb = true)
    {
        if (!$this->isPhpEnvironmentSupported()) {
            throw new ConnectionException("Function pg_connect doesn't exist");
        }

        //Can throw warning, if have incorrect connection params
        //So we need '@'
        $this
            ->getLogger()
            ->startConnection('Pgsql connection');
        $connectString  = $this->generateConnectionString($selectDb);
        $this->resource = @\pg_connect($connectString);
        $this
            ->getLogger()
            ->stopConnection();

        if (!$this->resource) {
            $error = \error_get_last();
            throw new ConnectionException('Error ' . $error['message']);
        }
    }
742531
public function setFetchMode($mode)
    {
        switch ($mode) {
            case Zend_Db::FETCH_LAZY:
            case Zend_Db::FETCH_ASSOC:
            case Zend_Db::FETCH_NUM:
            case Zend_Db::FETCH_BOTH:
            case Zend_Db::FETCH_NAMED:
            case Zend_Db::FETCH_OBJ:
                $this->_fetchMode = $mode;
                break;
            case Zend_Db::FETCH_BOUND: // bound to PHP variable
                /**
                 * @see Zend_Db_Adapter_Mysqli_Exception
                 */
                // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
                throw new Zend_Db_Adapter_Mysqli_Exception('FETCH_BOUND is not supported yet');
                break;
            default:
                /**
                 * @see Zend_Db_Adapter_Mysqli_Exception
                 */
                // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
                throw new Zend_Db_Adapter_Mysqli_Exception("Invalid fetch mode '$mode' specified");
        }
    }
640495
public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = [])
    {
        $result = $this->client->query($statement, Arr::get(self::$options, 'timeout'));

        if ($result === false) {
            $exception = new Exception($this->client->error, $this->client->errno);
            throw new QueryException($statement, [], $exception);
        }

        return $result;
    }
7116
public function fetch(int $fetchStyle = \PDO::FETCH_ASSOC, int $cursorOrientation = \PDO::FETCH_ORI_NEXT, int $cursorOffset = 0)
    {
        return $this->statement->fetch($fetchStyle, $cursorOrientation, $cursorOffset);
    }
43141
private function _setErrorMode()
    {
        // get PDO object and enable exception error mode
        $pdo = $this->_getPdo();
        $this->_errMode = $pdo->getAttribute(PDO::ATTR_ERRMODE);
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
525122
function fetch($fetchMode = PDO::FETCH_ASSOC) {
        return $this->_data($this->query()->fetch($fetchMode),false);
        //return $this->query()->fetch($fetchMode);
    }
1268552
public function setStatement( $statement, $fetchMode = \PDO::FETCH_ASSOC )
    {
        if ( null !== ( $this->_statement = $statement ) )
        {
            $this->_statement->setFetchMode( $fetchMode );
        }

        return $this;
    }
337693
protected function fetchYield(...$fetchMode): Generator
	{
		$query = $this->compiler->select();

		yield from $this->connection->yield($query['sql'], $query['params'], ...$fetchMode);
	}
987809
private function getFetchMode($className, $fetchMode) : string
    {
        $fetchModeConstant = sprintf('%s::%s', Mapping\FetchMode::class, $fetchMode);

        if (! defined($fetchModeConstant)) {
            throw Mapping\MappingException::invalidFetchMode($className, $fetchMode);
        }

        return constant($fetchModeConstant);
    }
557009
public function setFetchMode($mode)
    {
        $this->_fetchMode = $mode;
        try {
            return $this->_stmt->setFetchMode($mode);
        } catch (PDOException $e) {
            // require_once 'Zend/Db/Statement/Exception.php';
            throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
        }
    }
1334320
public static function FetchAll($statement, $parameters = array(), $fetchMode = PDO::FETCH_ASSOC)
	{
		$db = self::connect($fetchMode);

		try
		{
			$query = $db->prepare($statement);
			
			if($query)
			{
				foreach($parameters as $key => $parameter)
				{
					if(!isset($parameter["type"]))
						$parameter["type"] = PDO::PARAM_STR;
					
					$query->bindParam($key,$parameter["value"],$parameter["type"]);
				}
				
				$query->execute();
			}
			else
			{
				throw new \Exception("Sorry, there was a problem with the query statement.");
			}
		}
		catch (PDOException $e)
		{
			$exception = "Sorry, there was a problem with the query. ({$e->getMessage()})";
		}

		if($exception) throw new \Exception($exception);
		
		return $query->fetchAll($fetchMode);
	}
486305
public function query($sql, $bind = [], $fetchMode = \PDO::FETCH_ASSOC, $useMaster = false)
    {
        $sql = $this->_replaceQuoteCharacters($sql);

        try {
            $statement = $bind ? $this->_execute($sql, $bind) : @$this->_getPdo()->query($sql);
        } catch (\PDOException $e) {
            $failed = true;

            if ($this->_transaction_level === 0 && !$this->_ping()) {
                try {
                    $this->close();
                    $statement = $bind ? $this->_execute($sql, $bind) : @$this->_getPdo()->query($sql);
                    $failed = false;
                } catch (\PDOException $e) {

                }
            }

            if ($failed) {
                throw new DbException([
                    ':message => ' . PHP_EOL . 'SQL: ":sql"' . PHP_EOL . ' BIND: :bind',
                    'message' => $e->getMessage(),
                    'sql' => $sql,
                    'bind' => json_encode($bind, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)
                ], 0, $e);
            }
        }

        return $statement->fetchAll($fetchMode);
    }
1108045
private function openConnection(\stdClass $initData)
    {
        $connectionOptions = $this->parseConnectionData($initData);
        if (isset($initData->persistentId) && !empty($initData->persistentId)) {
            $this->persistentConnect($connectionOptions, persistentId);
        } else {
            $this->notPersistentConnect($connectionOptions);
        }
        $this->executePostConnectionOptions($initData);
    }
943701
public function fetch($fetchMode = \PDO::FETCH_BOTH)
    {
        $fetchResult = $this->mysqliStatement->fetch();

        if ($fetchResult === false) {
            throw new MysqliException($this->mysqliStatement->error, $this->mysqliStatement->errno);
        }

        if ($fetchResult === null) {
            return;
        }

        $values = array();
        foreach ($this->result as $value) {
            $values[] = $value;
        }

        if ($fetchMode === null) {
            $fetchMode = $this->defaultFetchMode;
        }

        switch ($fetchMode) {
            case \PDO::FETCH_NUM:
                return $values;
            case \PDO::FETCH_ASSOC:
                return array_combine($this->resultFields, $values);
            case \PDO::FETCH_BOTH:
                $result = array_combine($this->resultFields, $values);
                $result += $values;

                return $result;
            default:
                throw MysqliException::fetchModeNotSupported($fetchMode);
        }
    }