protected function query(string $sql, array $params = [], array $options = []): \PDOStatement {
        $options += [
            Db::OPTION_FETCH_MODE => $this->getFetchArgs()
        ];

        $stm = $this->getPDO()->prepare($sql);


        if ($options[Db::OPTION_FETCH_MODE]) {
            $stm->setFetchMode(...(array)$options[Db::OPTION_FETCH_MODE]);
        }

        $r = $stm->execute($params);

        // This is a kludge for those that don't have errors turning into exceptions.
        if ($r === false) {
            list($state, $code, $msg) = $stm->errorInfo();
            throw new \PDOException($msg, $code);
        }

        return $stm;
    }
protected function query(string $sql, array $params = [], array $options = []): \PDOStatement {
        $options += [
            Db::OPTION_FETCH_MODE => $this->getFetchArgs()
        ];

        $stm = $this->getPDO()->prepare($sql);


        if ($options[Db::OPTION_FETCH_MODE]) {
            $stm->setFetchMode(...(array)$options[Db::OPTION_FETCH_MODE]);
        }

        $r = $stm->execute($params);

        // This is a kludge for those that don't have errors turning into exceptions.
        if ($r === false) {
            list($state, $code, $msg) = $stm->errorInfo();
            throw new \PDOException($msg, $code);
        }

        return $stm;
    }
protected function query ( string $ sql , array $ params = [ ] , array $ options = [ ] ) : \ PDOStatement { $ options += [ Db :: OPTION_FETCH_MODE => $ this -> getFetchArgs ( ) ] ; $ stm = $ this -> getPDO ( ) -> prepare ( $ sql ) ; if ( $ options [ Db :: OPTION_FETCH_MODE ] ) { $ stm -> setFetchMode ( ... ( array ) $ options [ Db :: OPTION_FETCH_MODE ] ) ; } $ r = $ stm -> execute ( $ params ) ; // This is a kludge for those that don't have errors turning into exceptions. if ( $ r === false ) { list ( $ state , $ code , $ msg ) = $ stm -> errorInfo ( ) ; throw new \ PDOException ( $ msg , $ code ) ; } return $ stm ; }
Execute a query that fetches data.

@param string $sql The query to execute.
@param array $params Input parameters for the query.
@param array $options Additional options.
@return \PDOStatement Returns the result of the query.
@throws \PDOException Throws an exception if something went wrong during the query.
Execute a query that fetches data .