public function fetchObject(
        $class = null,
        $table,
        $fields,
        $where = null,
        $options = []
    )
    {
        if (is_null($class)) {
            $class = 'StdClass';
        } elseif (is_object($class)) {
            $class = get_class($class);
        }
        if (is_scalar($fields)) {
            $fields = explode(',', $fields);
        }
        $query = new Select(
            $this,
            $table,
            $fields,
            new Where($where),
            new Options($options)
        );
        $stmt = $this->prepare($query->__toString());
        $stmt->execute($query->getBindings());
        $result = $stmt->fetchObject($class);
        if (!$result) {
            throw new SelectException($stmt->queryString);
        }
        return $result;
    }