/** * Update column in the SchemaElement with jdbc type and its length, * scale and precision. * @param column a ColumnElement to be updated * @param jdbcType jdbc type from java.sql.Types * @param length an Integer for length or <code>null</code> * if it does not apply * @param scale an Integer for scale or <code>null</code> * if it does not apply * @param precision an Integer for precision or <code>null</code> * if it does not apply */ public static void updateColumn(ColumnElement column, int jdbcType, Integer length, Integer scale, Integer precision) throws DBException { column.setType(jdbcType); column.setLength(length); column.setScale(scale); column.setPrecision(precision); }
/** * Create column and add to the table. * @param columnName Name of the column to create. * @param declaringTbl The declaring table to which column gets added. * @return ColumnElement that represents the newly-added column. * @throws DBException */ static ColumnElement createAndAttachColumn(String columnName, TableElement table, JDBCInfo ji) throws DBException { // Create column id String fullName = NameUtil.getAbsoluteMemberName( table.getName().getName(), columnName); DBIdentifier columnId = DBIdentifier.create(columnName); ColumnElementImpl columnImpl = new ColumnElementImpl(); ColumnElement column = new ColumnElement(columnImpl, table); column.setName(columnId); column.setType(ji.getJdbcType()); column.setNullable(ji.getNullable()); column.setPrecision(ji.getPrecision()); column.setScale(ji.getScale()); column.setLength(ji.getLength()); table.addColumn(column); return column; }