public function getString()
    {
        if (empty($this->sql) || empty($this->entity)) {
            return null;
        }

        $query = "";
        $query .= $this->sql;

        if (0==count($this->projection)) {
            $query .= " "."*";
        } else {
            if (count($this->projection)) {
                $query .= " " . implode(", ", $this->projection);
            }
        }

        $query .= " FROM " . $this->entity;

        if (!empty($this->whereClause)) {
            if (count($this->whereClause)) {
                $query .= " WHERE " . implode(" AND ", $this->whereClause);
            }
        }

        if (!empty($this->orderByClause)) {
            $query .= " ORDERBY " . $this->orderByClause;
        }

        if (!empty($this->startposition)) {
            $query .= " STARTPOSITION " . $this->startposition;
        }

        if (!empty($this->maxresults)) {
            $query .= " MAXRESULTS " . $this->maxresults;
        }

        return $query;
    }