/** * Sets the length (in type specific units) for the new column. */ public ColumnBuilder setLengthInUnits(int unitLength) { return setLength(_type.fromUnitSize(unitLength)); }
/** * Sets the length for the new column to the max length for the type. Does * nothing for types which are not variable length. */ public ColumnBuilder setMaxLength() { // length setting only makes sense for variable length columns if(_type.isVariableLength()) { setLength(_type.getMaxSize()); } return this; }
columns.add(new ColumnBuilder((String)columnNames[i], DataType.TEXT) .escapeName() .setLength((short)DataType.TEXT.getMaxSize()) .toColumn());
/** * Sets all attributes except name from the given Column template (including * all column properties except GUID). */ public ColumnBuilder setFromColumn(Column template) throws IOException { DataType type = template.getType(); setType(type); setLength(template.getLength()); setAutoNumber(template.isAutoNumber()); if(type.getHasScalePrecision()) { setScale(template.getScale()); setPrecision(template.getPrecision()); } setCalculated(template.isCalculated()); setCompressedUnicode(template.isCompressedUnicode()); setHyperlink(template.isHyperlink()); if(template instanceof ColumnImpl) { setTextSortOrder(((ColumnImpl)template).getTextSortOrder()); } PropertyMap colProps = template.getProperties(); for(PropertyMap.Property colProp : colProps) { // copy everything but guid if(!PropertyMap.GUID_PROP.equalsIgnoreCase(colProp.getName())) { setProperty(colProp.getName(), colProp); } } return this; }