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; }
/** 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); }
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; }
/** * 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); } }
/** 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; }