private Expression getExpression() { if (expression == null) { ArrayList<Expression> expressions = query.getExpressions(); int columnCount = query.getColumnCount(); if (columnCount == 1) { expression = expressions.get(0); } else { Expression[] list = new Expression[columnCount]; for (int i = 0; i < columnCount; i++) { list[i] = expressions.get(i); } expression = new ExpressionList(list); } } return expression; }
@Override public void init() { if (SysProperties.CHECK && checkInit) { DbException.throwInternalError(); } checkInit = true; left.init(); right.init(); int len = left.getColumnCount(); if (len != right.getColumnCount()) { throw DbException.get(ErrorCode.COLUMN_COUNT_DOES_NOT_MATCH); } ArrayList<Expression> le = left.getExpressions(); // set the expressions to get the right column count and names, // but can't validate at this time expressions = New.arrayList(); for (int i = 0; i < len; i++) { Expression l = le.get(i); expressions.add(l); } }
ArrayList<Expression> le = left.getExpressions(); ArrayList<Expression> re = right.getExpressions(); for (int i = 0; i < len; i++) { Expression l = le.get(i);
private void generateColumnsFromQuery() { int columnCount = prepared.getQuery().getColumnCount(); ArrayList<Expression> expressions = prepared.getQuery().getExpressions(); for (int i = 0; i < columnCount; i++) { Expression expr = expressions.get(i); int type = expr.getType(); String name = expr.getAlias(); long precision = expr.getPrecision(); int displaySize = expr.getDisplaySize(); DataType dt = DataType.getDataType(type); if (precision > 0 && (dt.defaultPrecision == 0 || (dt.defaultPrecision > precision && dt.defaultPrecision < Byte.MAX_VALUE))) { // dont' set precision to MAX_VALUE if this is the default precision = dt.defaultPrecision; } int scale = expr.getScale(); if (scale > 0 && (dt.defaultScale == 0 || (dt.defaultScale > scale && dt.defaultScale < precision))) { scale = dt.defaultScale; } if (scale > precision) { precision = scale; } Column col = new Column(name, type, precision, scale, displaySize); prepared.addColumn(col); } }
this.querySQL = query.getSQL(); tables = New.arrayList(query.getTables()); ArrayList<Expression> expressions = query.getExpressions(); ArrayList<Column> list = New.arrayList(); for (int i = 0, count = query.getColumnCount(); i < count; i++) {