src/EasyDB.php
public function safeQuery(
        string $statement,
        array $params = [],
        int $fetchStyle = self::DEFAULT_FETCH_STYLE,
        bool $returnNumAffected = false,
        bool $calledWithVariadicParams = false
    ) {
        if ($fetchStyle === self::DEFAULT_FETCH_STYLE) {
            if (isset($this->options[\PDO::ATTR_DEFAULT_FETCH_MODE])) {
                /**
                 * @var int $fetchStyle
                 */
                $fetchStyle = $this->options[\PDO::ATTR_DEFAULT_FETCH_MODE];
            } else {
                $fetchStyle = \PDO::FETCH_ASSOC;
            }
        }

        if (empty($params)) {
            $stmt = $this->pdo->query($statement);
            if ($returnNumAffected) {
                return (int) $stmt->rowCount();
            }
            return $this->getResultsStrictTyped($stmt, $fetchStyle);
        }
        if (!$this->is1DArray($params)) {
            if ($calledWithVariadicParams) {
                throw new Issues\MustBeOneDimensionalArray(
                    'Only one-dimensional arrays are allowed, please use ' .
                    __METHOD__ .
                    '()'
                );
            }

            throw new Issues\MustBeOneDimensionalArray(
                'Only one-dimensional arrays are allowed.'
            );
        }
        $stmt = $this->prepare($statement);
        $stmt->execute($params);
        if ($returnNumAffected) {
            return (int) $stmt->rowCount();
        }
        return $this->getResultsStrictTyped($stmt, $fetchStyle);
    }
public function safeQuery(
        string $statement,
        array $params = [],
        int $fetchStyle = self::DEFAULT_FETCH_STYLE,
        bool $returnNumAffected = false,
        bool $calledWithVariadicParams = false
    ) {
        if ($fetchStyle === self::DEFAULT_FETCH_STYLE) {
            if (isset($this->options[\PDO::ATTR_DEFAULT_FETCH_MODE])) {
                /**
                 * @var int $fetchStyle
                 */
                $fetchStyle = $this->options[\PDO::ATTR_DEFAULT_FETCH_MODE];
            } else {
                $fetchStyle = \PDO::FETCH_ASSOC;
            }
        }

        if (empty($params)) {
            $stmt = $this->pdo->query($statement);
            if ($returnNumAffected) {
                return (int) $stmt->rowCount();
            }
            return $this->getResultsStrictTyped($stmt, $fetchStyle);
        }
        if (!$this->is1DArray($params)) {
            if ($calledWithVariadicParams) {
                throw new Issues\MustBeOneDimensionalArray(
                    'Only one-dimensional arrays are allowed, please use ' .
                    __METHOD__ .
                    '()'
                );
            }

            throw new Issues\MustBeOneDimensionalArray(
                'Only one-dimensional arrays are allowed.'
            );
        }
        $stmt = $this->prepare($statement);
        $stmt->execute($params);
        if ($returnNumAffected) {
            return (int) $stmt->rowCount();
        }
        return $this->getResultsStrictTyped($stmt, $fetchStyle);
    }
public function safeQuery ( string $ statement , array $ params = [ ] , int $ fetchStyle = self :: DEFAULT_FETCH_STYLE , bool $ returnNumAffected = false , bool $ calledWithVariadicParams = false ) { if ( $ fetchStyle === self :: DEFAULT_FETCH_STYLE ) { if ( isset ( $ this -> options [ \ PDO :: ATTR_DEFAULT_FETCH_MODE ] ) ) { /**
                 * @var int $fetchStyle
                 */ $ fetchStyle = $ this -> options [ \ PDO :: ATTR_DEFAULT_FETCH_MODE ] ; } else { $ fetchStyle = \ PDO :: FETCH_ASSOC ; } } if ( empty ( $ params ) ) { $ stmt = $ this -> pdo -> query ( $ statement ) ; if ( $ returnNumAffected ) { return ( int ) $ stmt -> rowCount ( ) ; } return $ this -> getResultsStrictTyped ( $ stmt , $ fetchStyle ) ; } if ( ! $ this -> is1DArray ( $ params ) ) { if ( $ calledWithVariadicParams ) { throw new Issues \ MustBeOneDimensionalArray ( 'Only one-dimensional arrays are allowed, please use ' . __METHOD__ . '()' ) ; } throw new Issues \ MustBeOneDimensionalArray ( 'Only one-dimensional arrays are allowed.' ) ; } $ stmt = $ this -> prepare ( $ statement ) ; $ stmt -> execute ( $ params ) ; if ( $ returnNumAffected ) { return ( int ) $ stmt -> rowCount ( ) ; } return $ this -> getResultsStrictTyped ( $ stmt , $ fetchStyle ) ; }
Perform a Parametrized Query

@param  string $statement         The query string (hopefully untainted
by user input)
@param  array  $params            The parameters (used in prepared
statements)
@param  int    $fetchStyle        PDO::FETCH_STYLE
@param  bool   $returnNumAffected Return the number of rows affected?
@param  bool   $calledWithVariadicParams Indicates method is being invoked from variadic $params method
@return array|int|object
@throws \InvalidArgumentException
@throws Issues\QueryError
@throws \TypeError
Perform a Parametrized Query