Example #1
0
  public String toString() {
    StringBuffer buf = new StringBuffer("insert into " + table_);
    if (columns_ != null && columns_.size() > 0) {
      buf.append("(" + columns_.elementAt(0));
      for (int i = 1; i < columns_.size(); i++) {
        buf.append("," + columns_.elementAt(i));
      }
      buf.append(")");
    }

    String vlist = valueSpec_.toString();
    buf.append(" ");
    if (getValues() != null) buf.append("values ");
    if (vlist.startsWith("(")) buf.append(vlist);
    else buf.append(" (" + vlist + ")");

    return buf.toString();
  }
Example #2
0
  public String toString() {
    StringBuffer buf = new StringBuffer("update " + table_);
    if (alias_ != null) buf.append(" " + alias_);
    buf.append(" set ");

    Enumeration e;
    if (columns_ != null) e = columns_.elements();
    else e = set_.keys();
    boolean first = true;
    while (e.hasMoreElements()) {
      String key = e.nextElement().toString();
      if (!first) buf.append(", ");
      buf.append(key + "=" + set_.get(key).toString());
      first = false;
    }

    if (where_ != null) buf.append(" where " + where_.toString());
    return buf.toString();
  }