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

        if ($this->values[0] != null) {
            $sql .= '(' . $this->values[0] . ') ';
        }
        if ($this->values[1] != null) {
            $sql .= 'VALUES (' . $this->values[1] . ') ';
        } else {
            $sql .= 'DEFAULT VALUES ';
        }

        if ($this->returning != null) {
            $sql .= 'RETURNING ' . $this->returning;
        }

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

        if ($this->values[0] != null) {
            $sql .= '(' . $this->values[0] . ') ';
        }
        if ($this->values[1] != null) {
            $sql .= 'VALUES (' . $this->values[1] . ') ';
        } else {
            $sql .= 'DEFAULT VALUES ';
        }

        if ($this->returning != null) {
            $sql .= 'RETURNING ' . $this->returning;
        }

        return $sql;
    }
Extract the corresponding SQL code.

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