private function getSQL() {
        try {
            $this->checkDialect();
        } catch (DialectException $e) {
            return null;
        }
        if (!$this->values) {
            $this->values = new BindValues ();
        } else if (!$this->valueFixed) {
            $this->values->reset();
        }
        $fields = $this->prepareFields($this->fields, $this->values);
        $from   = $this->prepareFrom($this->sanitize($this->from));
        $joins  = $this->prepareJoins($this->sanitize($this->joins));
        $having = $this->sanitize($this->having);
        $group  = $this->sanitize($this->group);
        $order  = $this->sanitize($this->order);

        return $this->dialect->getSelectSQL($fields, $from, $joins, $this->where, $having, $group, $order, $this->limit, $this->values, $this->forupdate);
    }