Exemple #1
0
  void addTableColumns(Expression expression, HashSet exclude) {

    HsqlArrayList list = new HsqlArrayList();
    Table table = getTable();
    int count = table.getColumnCount();

    for (int i = 0; i < count; i++) {
      ColumnSchema column = table.getColumn(i);
      String columnName =
          columnAliases == null ? column.getName().name : (String) columnAliases.get(i);

      if (exclude != null && exclude.contains(columnName)) {
        continue;
      }

      Expression e = new ExpressionColumn(this, column, i);

      list.add(e);
    }

    Expression[] nodes = new Expression[list.size()];

    list.toArray(nodes);

    expression.nodes = nodes;
  }
Exemple #2
0
  /** Add all columns to a list of expressions */
  void addTableColumns(HsqlArrayList exprList) {

    if (namedJoinColumns != null) {
      int count = exprList.size();
      int position = 0;

      for (int i = 0; i < count; i++) {
        Expression e = (Expression) exprList.get(i);
        String columnName = e.getColumnName();

        if (namedJoinColumns.contains(columnName)) {
          if (position != i) {
            exprList.remove(i);
            exprList.add(position, e);
          }

          e = getColumnExpression(columnName);

          exprList.set(position, e);

          position++;
        }
      }
    }

    addTableColumns(exprList, exprList.size(), namedJoinColumns);
  }
Exemple #3
0
  public OrderedHashSet getUniqueColumnNameSet() {

    OrderedHashSet set = new OrderedHashSet();

    if (columnAliases != null) {
      set.addAll(columnAliases);

      return set;
    }

    for (int i = 0; i < rangeTable.columnList.size(); i++) {
      String name = rangeTable.getColumn(i).getName().name;
      boolean added = set.add(name);

      if (!added) {
        throw Error.error(ErrorCode.X_42578, name);
      }
    }

    return set;
  }
Exemple #4
0
  /**
   * Retruns index for column
   *
   * @param columnName name of column
   * @return int index or -1 if not found
   */
  public int findColumn(String columnName) {

    if (namedJoinColumnExpressions != null && namedJoinColumnExpressions.containsKey(columnName)) {
      return -1;
    }

    if (variables != null) {
      return variables.getIndex(columnName);
    } else if (columnAliases != null) {
      return columnAliases.getIndex(columnName);
    } else {
      return rangeTable.findColumn(columnName);
    }
  }
Exemple #5
0
  /** Add all columns to a list of expressions */
  int addTableColumns(HsqlArrayList expList, int position, HashSet exclude) {

    Table table = getTable();
    int count = table.getColumnCount();

    for (int i = 0; i < count; i++) {
      ColumnSchema column = table.getColumn(i);
      String columnName =
          columnAliases == null ? column.getName().name : (String) columnAliases.get(i);

      if (exclude != null && exclude.contains(columnName)) {
        continue;
      }

      Expression e = new ExpressionColumn(this, column, i);

      expList.add(position++, e);
    }

    return position;
  }