/** * Sets all attributes except name from the given Column template. */ public ColumnBuilder setFromColumn(ColumnBuilder template) { DataType type = template.getType(); _type = type; _length = template._length; _autoNumber = template._autoNumber; if(type.getHasScalePrecision()) { _scale = template._scale; _precision = template._precision; } _calculated = template._calculated; _compressedUnicode = template._compressedUnicode; _hyperlink = template._hyperlink; _sortOrder = template._sortOrder; if(template._props != null) { _props = new HashMap<String,PropertyMap.Property>(template._props); } return this; }
/** * Sets the scale for the new column to the max length for the type. Does * nothing for types which do not have a scale. */ public ColumnBuilder setMaxScale() { if(_type.getHasScalePrecision()) { setScale(_type.getMaxScale()); } return this; }
/** * Sets the precision for the new column to the max length for the type. * Does nothing for types which do not have a precision. */ public ColumnBuilder setMaxPrecision() { if(_type.getHasScalePrecision()) { setPrecision(_type.getMaxPrecision()); } return this; }
if(_type.getHasScalePrecision()) { sb.append("precision", getPrecision()) .append("scale", getScale());
} else { if(col.getType().getHasScalePrecision() && !col.isCalculated()) { col.getType().getHasScalePrecision()) { length = CalculatedColumnUtil.CALC_FIXED_FIELD_LEN; } else {
/** * Creates the appropriate ColumnImpl class for a calculated column and * reads a column definition in from a buffer * * @param args column construction info * @usage _advanced_method_ */ static ColumnImpl create(ColumnImpl.InitArgs args) throws IOException { switch(args.type) { case BOOLEAN: return new CalcBooleanColImpl(args); case TEXT: return new CalcTextColImpl(args); case MEMO: return new CalcMemoColImpl(args); default: // fall through } if(args.type.getHasScalePrecision()) { return new CalcNumericColImpl(args); } return new CalcColImpl(args); }
column.setLengthInUnits((short)lengthInUnits); if(type.getHasScalePrecision()) { int scale = md.getScale(i); int precision = md.getPrecision(i);
if(args.type.getHasScalePrecision()) { return new NumericColumnImpl(args);
if(getType().getHasScalePrecision()) { if(!getType().isValidScale(getScale())) { throw new IllegalArgumentException(withErrorContext(
/** * 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; }