protected function perform($statement, array $bindings = [], $class = null)
    {
        $this->connect();

        if (empty($bindings)) {
            try {
                if (($sth = $this->pdo->query($statement)) === false) {
                    throw new PDOException('Execute SQL query failed!');
                }
            }
            catch (PDOException $e) {
                throw new QueryException($statement, $bindings, $statement, $e);
            }
        }
        else {
            try {
                $sth = $this->pdo->prepare($statement);

                foreach ($bindings as $key => $value) {
                    if (is_int($key)) {
                        $key += 1;
                    }

                    if ($value instanceof DateTimeInterface) {
                        $value = $value->format($this->dateFormat);
                    }
                    else if ($value === false) { // das macht Eloquent!
                        $value = 0;
                    }

                    $type = is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR;
                    $sth->bindValue($key, $value, $type);
                }

                if ($sth->execute() === false) {
                    throw new PDOException('Execute SQL query failed!');
                }
            }
            catch (PDOException $e) {
                throw new QueryException($statement, $bindings, $this->dump($statement, $bindings, true), $e);
            }
        }

        if ($class !== null) {
            /** @noinspection PhpMethodParametersCountMismatchInspection */
            $sth->setFetchMode(PDO::FETCH_CLASS, $class);
        }

        return $sth;
    }