public function fetchAll(int $fetchMode = null, array $driverOptions = []): array
    {
        try {
            if (null === $fetchMode) {
                return $this->pdoStatement->fetchAll();
            }

            if (PDO::FETCH_COLUMN == $fetchMode) {
                return $this->pdoStatement->fetchAll(
                        PDO::FETCH_COLUMN,
                        $driverOptions['columnIndex'] ?? 0
                );
            }

            if (PDO::FETCH_CLASS == $fetchMode) {
                if (!isset($driverOptions['classname'])) {
                    throw new \InvalidArgumentException('Tried to use PDO::FETCH_CLASS but no classname given in driver options.');
                }

                return $this->pdoStatement->fetchAll(
                        PDO::FETCH_CLASS,
                        $driverOptions['classname'],
                        $driverOptions['arguments'] ?? null
                );
            }

            if (PDO::FETCH_FUNC == $fetchMode) {
                if (!isset($driverOptions['function'])) {
                    throw new \InvalidArgumentException('Tried to use PDO::FETCH_FUNC but no function given in driver options.');
                }

                return $this->pdoStatement->fetchAll(
                        PDO::FETCH_FUNC,
                        $driverOptions['function']
                );
            }

            return $this->pdoStatement->fetchAll($fetchMode);
        } catch (PDOException $pdoe) {
            throw new DatabaseException($pdoe->getMessage(), $pdoe);
        }
    }