Esempio n. 1
0
 /** returns the parameters used in this statement's expressions and in the whereClause. */
 public Vector getParameters() {
   Vector v = new Vector();
   Enumeration valenum = getValues().elements();
   while (valenum.hasMoreElements()) {
     tsResultRow row = (tsResultRow) valenum.nextElement();
     for (int i = 0; i < row.size(); i++) {
       tsColumn col = row.getColumnDefinition(i);
       if (col.getColumnType() == tsColumn.COL_EXPR) {
         ParserUtils.getParameterElements(v, col.getExpression());
       }
     }
   }
   return v;
 }
Esempio n. 2
0
  /**
   * Adds the Values to this insertStatement. If also a SelectStatement is added, the Select has
   * precedence to the values. This function expects a vector of LValues. The size of the vector
   * must match the number of the columns defined.
   */
  public void addValues(Vector v) throws tinySQLException {
    if (v.size() != columns.size())
      throw new tinySQLException("Columns-Size does not match values-size");

    Vector sourceCols = new Vector();
    for (int i = 0; i < columns.size(); i++) {
      tsColumn target_col = (tsColumn) columns.elementAt(i);
      tsColumn source_col = new tsColumn(target_col.getPhysicalName(), (LValue) v.elementAt(i));
      source_col.setAll(target_col);
      sourceCols.addElement(source_col);
    }

    tsResultRow expressed = new tsResultRow(sourceCols);
    values.add(expressed);
  }