/** * @usage _advanced_method_ */ protected ColumnImpl(TableImpl table, String name, DataType type, int colNumber, int fixedOffset, int varLenIndex) { _table = table; _name = name; _type = type; if(!_type.isVariableLength()) { _columnLength = (short)type.getFixedSize(); } else { _columnLength = (short)type.getMaxSize(); } _variableLength = type.isVariableLength(); _autoNumber = false; _calculated = false; _autoNumberGenerator = null; _columnNumber = (short)colNumber; _columnIndex = colNumber; _displayIndex = colNumber; _fixedDataOffset = fixedOffset; _varLenTableIndex = varLenIndex; }
public boolean isTrueVariableLength() { // some "var len" fields do not really have a variable length, // e.g. NUMERIC return (isVariableLength() && (getMinSize() != getMaxSize())); }
@Override public Object read(byte[] data, ByteOrder order) throws IOException { data = unwrapCalculatedValue(data); if((data.length == 0) && !getType().isVariableLength()) { // apparently "null" values can be written as actual data return null; } return super.read(data, order); }
public short getLength() { return ((_length != null) ? _length : (short)(!_type.isVariableLength() ? _type.getFixedSize() : _type.getDefaultSize())); }
/** * 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; }
public boolean isVariableLength() { // calculated columns are written as var len return(getType().isVariableLength() || isCalculated()); }
/** * Only used by unit tests * @usage _advanced_method_ */ protected TableImpl(boolean testing, List<ColumnImpl> columns) throws IOException { if(!testing) { throw new IllegalArgumentException(); } _database = null; _tableDefPageNumber = PageChannel.INVALID_PAGE_NUMBER; _name = null; _columns.addAll(columns); for(ColumnImpl col : _columns) { if(col.getType().isVariableLength()) { _varColumns.add(col); } } _maxColumnCount = (short)_columns.size(); _maxVarColumnCount = (short)_varColumns.size(); initAutoNumberColumns(); _fkEnforcer = null; _flags = 0; _tableType = TYPE_USER; _indexCount = 0; _logicalIndexCount = 0; _ownedPages = null; _freeSpacePages = null; }
if(rtn.isVariableLength() && !rtn.isValidSize(size)) {
if(col.isCalculated()) { if(!col.getType().isVariableLength() || col.getType().getHasScalePrecision()) { length = CalculatedColumnUtil.CALC_FIXED_FIELD_LEN;
throws IOException if(!isVariableLength() || !getType().isVariableLength()) { return writeFixedLengthField(obj, order);
if(!getType().isVariableLength()) { if(getLength() < getType().getFixedSize()) { throw new IllegalArgumentException(withErrorContext(