public function toSql()
    {
        if (empty($this->from) === true) {
            throw new BadUse('from clause has not been defined (' . print_r($this, true) . ')');
        }
        $sql = 'DELETE FROM ' . $this->from . ' ';

        if ($this->where != null) {
            $sql .= 'WHERE ' . $this->where->toSql() . ' ';
        }
        if ($this->orderBy != null) {
            $sql .= 'ORDER BY ' . $this->orderBy . ' ';
        }
        if ($this->limit != null) {
            $sql .= 'LIMIT ' . $this->limit . ' ';
        }

        return $sql;
    }
public function toSql()
    {
        if (empty($this->from) === true) {
            throw new BadUse('from clause has not been defined (' . print_r($this, true) . ')');
        }
        $sql = 'DELETE FROM ' . $this->from . ' ';

        if ($this->where != null) {
            $sql .= 'WHERE ' . $this->where->toSql() . ' ';
        }
        if ($this->orderBy != null) {
            $sql .= 'ORDER BY ' . $this->orderBy . ' ';
        }
        if ($this->limit != null) {
            $sql .= 'LIMIT ' . $this->limit . ' ';
        }

        return $sql;
    }
Extract the corresponding SQL code.

@throws BadUse if from clause has not been defined
@return string generated SQL code