/** * Get the system columns that this table understands. This is used for * compatibility with other databases. The columns are only returned if the * current mode supports system columns. * * @return the system columns */ @Override public Column[] getSystemColumns() { if (!session.getDatabase().getMode().systemColumns) { return null; } Column[] sys = new Column[3]; sys[0] = new Column("oid", Value.INT); sys[0].setTable(table, 0); sys[1] = new Column("ctid", Value.STRING); sys[1].setTable(table, 0); sys[2] = new Column("CTID", Value.STRING); sys[2].setTable(table, 0); return sys; }
protected void setColumns(Column[] columns) { this.columns = columns; if (columnMap.size() > 0) { columnMap.clear(); } for (int i = 0; i < columns.length; i++) { Column col = columns[i]; int dataType = col.getType(); if (dataType == Value.UNKNOWN) { throw DbException.get(ErrorCode.UNKNOWN_DATA_TYPE_1, col.getSQL()); } col.setTable(this, i); String columnName = col.getName(); if (columnMap.get(columnName) != null) { throw DbException.get(ErrorCode.DUPLICATE_COLUMN_NAME_1, columnName); } columnMap.put(columnName, col); } }
SelectListColumnResolver(Select select) { this.select = select; int columnCount = select.getColumnCount(); columns = new Column[columnCount]; expressions = new Expression[columnCount]; ArrayList<Expression> columnList = select.getExpressions(); for (int i = 0; i < columnCount; i++) { Expression expr = columnList.get(i); Column column = new Column(expr.getAlias(), Value.NULL); column.setTable(null, i); columns[i] = column; expressions[i] = expr.getNonAliasExpression(); } }
int type = DataType.convertSQLTypeToValueType(sqlType); Column col = new Column(n, type, precision, scale, displaySize); col.setTable(this, i++); columnList.add(col); columnMap.put(n, col); int type = DataType.getValueTypeFromResultSet(rsMeta, i + 1); Column col = new Column(n, type, precision, scale, displaySize); col.setTable(this, i++); columnList.add(col); columnMap.put(n, col);
int displaySize = expr.getDisplaySize(); Column col = new Column(name, type, precision, scale, displaySize); col.setTable(this, i);