Class ColumnImpl
- java.lang.Object
-
- com.healthmarketscience.jackcess.impl.ColumnImpl
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classColumnImpl.AutoNumberGeneratorBase class for the supported autonumber types.static classColumnImpl.SortOrderInformation about the sort order (collation) for a textual column.
-
Field Summary
Fields Modifier and Type Field Description static byteAUTO_NUMBER_FLAG_MASKmask for the auto number bitstatic byteAUTO_NUMBER_GUID_FLAG_MASKmask for the auto number guid bitstatic LocalDateBASE_LDstatic LocalDateTimeBASE_LDTstatic LocalTimeBASE_LTstatic byteCOMPLEX_FK_EXT_FLAG_MASKmask for the ext flag which marks the complex value foreign key column of a complex column's flat table.static byteFIXED_LEN_FLAG_MASKmask for the fixed len bitstatic ColumnImpl.SortOrderGENERAL_97_SORT_ORDERthe "general" text sort order, version (access 1997)static ColumnImpl.SortOrderGENERAL_LEGACY_SORT_ORDERthe "general" text sort order, legacy version (access 2000-2007)static ColumnImpl.SortOrderGENERAL_SORT_ORDERthe "general" text sort order, latest version (access 2010+)static byteHIDDEN_FLAG_MASKmask for the bit which marks a column ms access maintains and hides.static byteHYPERLINK_FLAG_MASKmask for the hyperlink bit (on memo types)static ObjectRETURN_ROW_IDPlaceholder object for adding rows which indicates that the caller wants the RowId of the new row.static byteSECURITY_IDENTIFIER_FLAG_MASKmask for the bit which marks a column holding a windows security identifier.static byteUPDATABLE_FLAG_MASKmask for the "is updatable" field bit-
Fields inherited from interface com.healthmarketscience.jackcess.Column
AUTO_NUMBER, KEEP_VALUE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static shortcountVariableLength(List<ColumnBuilder> columns)static ColumnImplcreate(TableImpl table, ByteBuffer buffer, int offset, String name, int displayIndex)Creates the appropriate ColumnImpl class and reads a column definition in from a bufferstatic StringdecodeUncompressedText(byte[] textBytes, Charset charset)static ByteBufferencodeUncompressedText(CharSequence text, Charset charset)longfromDateDouble(double value)Returns a java long time value converted from an access date double.ObjectgenerateDefaultValue()Returns a default value for this columnColumnImpl.AutoNumberGeneratorgetAutoNumberGenerator()Returns the AutoNumberGenerator for this column if this is an autonumber column,nullotherwise.shortgetColumnId()Returns the id which ms access gave this column when it was created.intgetColumnIndex()shortgetColumnNumber()ColumnValidatorgetColumnValidator()Gets currently configured ColumnValidator (always non-null).ComplexColumnInfo<? extends ComplexValue>getComplexInfo()Returns extended functionality for "complex" columns.DatabaseImplgetDatabase()com.healthmarketscience.jackcess.impl.ColumnImpl.DateTimeFactorygetDateTimeFactory()intgetDisplayIndex()intgetFixedDataOffset()JetFormatgetFormat()shortgetLength()shortgetLengthInUnits()StringgetName()intgetOwnedPageCount()Returns the number of database pages owned by this column.PageChannelgetPageChannel()bytegetPrecision()PropertyMapgetProperties()ObjectgetRowValue(Object[] rowArray)ObjectgetRowValue(Map<String,?> rowMap)bytegetScale()intgetSQLType()TableImplgetTable()shortgetTextCodePage()ColumnImpl.SortOrdergetTextSortOrder()TimeZonegetTimeZone()DataTypegetType()intgetVarLenTableIndex()ColumnImplgetVersionHistoryColumn()Returns the column which tracks the version history for an "append only" column.ZoneIdgetZoneId()booleanisAppendOnly()Whether or not this column is "append only" (its history is tracked by a separate version history column).booleanisAutoNumber()booleanisCalculated()Returns whether or not this is a calculated column.booleanisComplexValueForeignKey()Returnstrueif this column is the complex value foreign key of a complex column's flat table, the column which points back at the row in the owning table.booleanisCompressedUnicode()booleanisHidden()Returns whether or not ms access maintains this column and hides it.booleanisHyperlink()Returns whether or not this is a hyperlink column (only possible for columns of type MEMO).static booleanisRawData(Object value)Returnstrueif the given value is "raw" column data,falseotherwise.booleanisSecurityIdentifier()Returns whether or not this column holds a windows security identifier.booleanisVariableLength()static LocalDateTimeldtFromLocalDateDouble(double value)static com.healthmarketscience.jackcess.impl.ColumnImpl.RawDatarawDataWrapper(byte[] bytes)Returns a wrapper for raw column data that can be written without understanding the data.Objectread(byte[] data)Deserialize a raw byte value for this column into an ObjectObjectread(byte[] data, ByteOrder order)Deserialize a raw byte value for this column into an ObjectObjectreadFromNullMask(boolean isNull)voidsetColumnIndex(int newColumnIndex)voidsetColumnValidator(ColumnValidator newValidator)Sets a new ColumnValidator.ObjectsetRowValue(Object[] rowArray, Object value)ObjectsetRowValue(Map<String,Object> rowMap, Object value)voidsetVersionHistoryColumn(ColumnImpl versionHistoryCol)booleanstoreInNullMask()static booleantoBooleanValue(Object obj)Interpret a boolean value (null == false)static byte[]toByteArray(Object value)static CharSequencetoCharSequence(Object value)doubletoDateDouble(Object value)Returns an access date double converted from a java Date/Calendar/Number time value.static doubletoDateDouble(LocalDateTime ldt)static ObjecttoInternalValue(DataType dataType, Object value, DatabaseImpl db)Converts the given value to the "internal" representation for the given data type.StringtoString()Objectvalidate(Object obj)Passes the given obj through the currently configured validator for this column and returns the result.ByteBufferwrite(Object obj, int remainingRowLength)Serialize an Object into a raw byte value for this column in little endian orderByteBufferwrite(Object obj, int remainingRowLength, ByteOrder order)Serialize an Object into a raw byte value for this columnbooleanwriteToNullMask(Object value)
-
-
-
Field Detail
-
RETURN_ROW_ID
public static final Object RETURN_ROW_ID
Placeholder object for adding rows which indicates that the caller wants the RowId of the new row. Must be added as an extra value at the end of the row values array.- See Also:
TableImpl.asRowWithRowId(java.util.Map<java.lang.String, ?>)- Usage:
- Intermediate: This field requires moderate API knowledge.
-
BASE_LD
public static final LocalDate BASE_LD
-
BASE_LT
public static final LocalTime BASE_LT
-
BASE_LDT
public static final LocalDateTime BASE_LDT
-
FIXED_LEN_FLAG_MASK
public static final byte FIXED_LEN_FLAG_MASK
mask for the fixed len bit- See Also:
- Constant Field Values
- Usage:
- Advanced: This field is for advanced/internal use.
-
AUTO_NUMBER_FLAG_MASK
public static final byte AUTO_NUMBER_FLAG_MASK
mask for the auto number bit- See Also:
- Constant Field Values
- Usage:
- Advanced: This field is for advanced/internal use.
-
AUTO_NUMBER_GUID_FLAG_MASK
public static final byte AUTO_NUMBER_GUID_FLAG_MASK
mask for the auto number guid bit- See Also:
- Constant Field Values
- Usage:
- Advanced: This field is for advanced/internal use.
-
HYPERLINK_FLAG_MASK
public static final byte HYPERLINK_FLAG_MASK
mask for the hyperlink bit (on memo types)- See Also:
- Constant Field Values
- Usage:
- Advanced: This field is for advanced/internal use.
-
UPDATABLE_FLAG_MASK
public static final byte UPDATABLE_FLAG_MASK
mask for the "is updatable" field bit- See Also:
- Constant Field Values
- Usage:
- Advanced: This field is for advanced/internal use.
-
HIDDEN_FLAG_MASK
public static final byte HIDDEN_FLAG_MASK
mask for the bit which marks a column ms access maintains and hides. The system catalog columns,MSysComplexColumnsincluded, and the replication columns carry it, and nothing else does.- See Also:
- Constant Field Values
- Usage:
- Advanced: This field is for advanced/internal use.
-
SECURITY_IDENTIFIER_FLAG_MASK
public static final byte SECURITY_IDENTIFIER_FLAG_MASK
mask for the bit which marks a column holding a windows security identifier. OnlyMSysObjects.OwnerandMSysACEs.SIDcarry it.- See Also:
- Constant Field Values
- Usage:
- Advanced: This field is for advanced/internal use.
-
COMPLEX_FK_EXT_FLAG_MASK
public static final byte COMPLEX_FK_EXT_FLAG_MASK
mask for the ext flag which marks the complex value foreign key column of a complex column's flat table. Access refuses to open a table whose flat table does not carry this bit, so it can be relied upon.- See Also:
- Constant Field Values
- Usage:
- Advanced: This field is for advanced/internal use.
-
GENERAL_97_SORT_ORDER
public static final ColumnImpl.SortOrder GENERAL_97_SORT_ORDER
the "general" text sort order, version (access 1997)- Usage:
- Intermediate: This field requires moderate API knowledge.
-
GENERAL_LEGACY_SORT_ORDER
public static final ColumnImpl.SortOrder GENERAL_LEGACY_SORT_ORDER
the "general" text sort order, legacy version (access 2000-2007)- Usage:
- Intermediate: This field requires moderate API knowledge.
-
GENERAL_SORT_ORDER
public static final ColumnImpl.SortOrder GENERAL_SORT_ORDER
the "general" text sort order, latest version (access 2010+)- Usage:
- Intermediate: This field requires moderate API knowledge.
-
-
Method Detail
-
create
public static ColumnImpl create(TableImpl table, ByteBuffer buffer, int offset, String name, int displayIndex) throws IOException
Creates the appropriate ColumnImpl class and reads a column definition in from a buffer- Parameters:
table- owning tablebuffer- Buffer containing column definitionoffset- Offset in the buffer at which the column definition starts- Throws:
IOException- Usage:
- Advanced: This method is for advanced/internal use.
-
getDatabase
public DatabaseImpl getDatabase()
- Specified by:
getDatabasein interfaceColumn
-
getFormat
public JetFormat getFormat()
- Usage:
- Advanced: This method is for advanced/internal use.
-
getPageChannel
public PageChannel getPageChannel()
- Usage:
- Advanced: This method is for advanced/internal use.
-
isVariableLength
public boolean isVariableLength()
- Specified by:
isVariableLengthin interfaceColumn
-
isAutoNumber
public boolean isAutoNumber()
- Specified by:
isAutoNumberin interfaceColumn
-
getColumnNumber
public short getColumnNumber()
- Usage:
- Advanced: This method is for advanced/internal use.
-
getColumnId
public short getColumnId()
Description copied from interface:ColumnReturns the id which ms access gave this column when it was created. An id is never renumbered, so a table which has had a column deleted has gaps in its ids and the id of a column differs from its index.- Specified by:
getColumnIdin interfaceColumn
-
isHidden
public boolean isHidden()
Description copied from interface:ColumnReturns whether or not ms access maintains this column and hides it. The columns of the system catalog tables,MSysComplexColumnsincluded, and the replication columns do.
-
isSecurityIdentifier
public boolean isSecurityIdentifier()
Description copied from interface:ColumnReturns whether or not this column holds a windows security identifier. OnlyMSysObjects.OwnerandMSysACEs.SIDdo.- Specified by:
isSecurityIdentifierin interfaceColumn
-
getColumnIndex
public int getColumnIndex()
- Specified by:
getColumnIndexin interfaceColumn
-
setColumnIndex
public void setColumnIndex(int newColumnIndex)
- Usage:
- Advanced: This method is for advanced/internal use.
-
getDisplayIndex
public int getDisplayIndex()
- Usage:
- Advanced: This method is for advanced/internal use.
-
getSQLType
public int getSQLType() throws IOException- Specified by:
getSQLTypein interfaceColumn- Throws:
IOException
-
isCompressedUnicode
public boolean isCompressedUnicode()
- Specified by:
isCompressedUnicodein interfaceColumn
-
getPrecision
public byte getPrecision()
- Specified by:
getPrecisionin interfaceColumn
-
getTextSortOrder
public ColumnImpl.SortOrder getTextSortOrder()
- Usage:
- Intermediate: This method requires moderate API knowledge.
-
getTextCodePage
public short getTextCodePage()
- Usage:
- Intermediate: This method requires moderate API knowledge.
-
getLengthInUnits
public final short getLengthInUnits()
- Specified by:
getLengthInUnitsin interfaceColumn
-
isCalculated
public boolean isCalculated()
Description copied from interface:ColumnReturns whether or not this is a calculated column. Note that jackess won't interpret the calculation expression (but the field can be written directly).- Specified by:
isCalculatedin interfaceColumn
-
isComplexValueForeignKey
public boolean isComplexValueForeignKey()
Returnstrueif this column is the complex value foreign key of a complex column's flat table, the column which points back at the row in the owning table.- Usage:
- Advanced: This method is for advanced/internal use.
-
getVarLenTableIndex
public int getVarLenTableIndex()
- Usage:
- Advanced: This method is for advanced/internal use.
-
getFixedDataOffset
public int getFixedDataOffset()
- Usage:
- Advanced: This method is for advanced/internal use.
-
getTimeZone
public TimeZone getTimeZone()
-
getZoneId
public ZoneId getZoneId()
-
getDateTimeFactory
public com.healthmarketscience.jackcess.impl.ColumnImpl.DateTimeFactory getDateTimeFactory()
-
isAppendOnly
public boolean isAppendOnly()
Description copied from interface:ColumnWhether or not this column is "append only" (its history is tracked by a separate version history column).- Specified by:
isAppendOnlyin interfaceColumn
-
getVersionHistoryColumn
public ColumnImpl getVersionHistoryColumn()
Description copied from interface:ColumnReturns the column which tracks the version history for an "append only" column.- Specified by:
getVersionHistoryColumnin interfaceColumn
-
getOwnedPageCount
public int getOwnedPageCount()
Returns the number of database pages owned by this column.- Usage:
- Intermediate: This method requires moderate API knowledge.
-
setVersionHistoryColumn
public void setVersionHistoryColumn(ColumnImpl versionHistoryCol)
- Usage:
- Advanced: This method is for advanced/internal use.
-
isHyperlink
public boolean isHyperlink()
Description copied from interface:ColumnReturns whether or not this is a hyperlink column (only possible for columns of type MEMO).- Specified by:
isHyperlinkin interfaceColumn
-
getComplexInfo
public ComplexColumnInfo<? extends ComplexValue> getComplexInfo()
Description copied from interface:ColumnReturns extended functionality for "complex" columns.- Specified by:
getComplexInfoin interfaceColumn
-
getColumnValidator
public ColumnValidator getColumnValidator()
Description copied from interface:ColumnGets currently configured ColumnValidator (always non-null).- Specified by:
getColumnValidatorin interfaceColumn
-
setColumnValidator
public void setColumnValidator(ColumnValidator newValidator)
Description copied from interface:ColumnSets a new ColumnValidator. Ifnull, resets to the value returned from the Database's ColumnValidatorFactory (if the factory returnsnull, then the default is used). Autonumber columns cannot have a validator instance other than the default.- Specified by:
setColumnValidatorin interfaceColumn
-
getAutoNumberGenerator
public ColumnImpl.AutoNumberGenerator getAutoNumberGenerator()
Returns the AutoNumberGenerator for this column if this is an autonumber column,nullotherwise.- Usage:
- Advanced: This method is for advanced/internal use.
-
getProperties
public PropertyMap getProperties() throws IOException
- Specified by:
getPropertiesin interfaceColumn- Returns:
- the properties for this column
- Throws:
IOException
-
setRowValue
public Object setRowValue(Object[] rowArray, Object value)
- Specified by:
setRowValuein interfaceColumn
-
setRowValue
public Object setRowValue(Map<String,Object> rowMap, Object value)
- Specified by:
setRowValuein interfaceColumn
-
getRowValue
public Object getRowValue(Object[] rowArray)
- Specified by:
getRowValuein interfaceColumn
-
getRowValue
public Object getRowValue(Map<String,?> rowMap)
- Specified by:
getRowValuein interfaceColumn
-
storeInNullMask
public boolean storeInNullMask()
-
writeToNullMask
public boolean writeToNullMask(Object value)
-
readFromNullMask
public Object readFromNullMask(boolean isNull)
-
read
public Object read(byte[] data) throws IOException
Deserialize a raw byte value for this column into an Object- Parameters:
data- The raw byte value- Returns:
- The deserialized Object
- Throws:
IOException- Usage:
- Advanced: This method is for advanced/internal use.
-
read
public Object read(byte[] data, ByteOrder order) throws IOException
Deserialize a raw byte value for this column into an Object- Parameters:
data- The raw byte valueorder- Byte order in which the raw value is stored- Returns:
- The deserialized Object
- Throws:
IOException- Usage:
- Advanced: This method is for advanced/internal use.
-
fromDateDouble
public long fromDateDouble(double value)
Returns a java long time value converted from an access date double.- Usage:
- Advanced: This method is for advanced/internal use.
-
ldtFromLocalDateDouble
public static LocalDateTime ldtFromLocalDateDouble(double value)
-
toDateDouble
public double toDateDouble(Object value) throws InvalidValueException
Returns an access date double converted from a java Date/Calendar/Number time value.- Throws:
InvalidValueException- Usage:
- Advanced: This method is for advanced/internal use.
-
toDateDouble
public static double toDateDouble(LocalDateTime ldt)
-
generateDefaultValue
public Object generateDefaultValue() throws IOException
Returns a default value for this column- Throws:
IOException
-
validate
public Object validate(Object obj) throws IOException
Passes the given obj through the currently configured validator for this column and returns the result.- Throws:
IOException
-
write
public ByteBuffer write(Object obj, int remainingRowLength) throws IOException
Serialize an Object into a raw byte value for this column in little endian order- Parameters:
obj- Object to serialize- Returns:
- A buffer containing the bytes
- Throws:
IOException- Usage:
- Advanced: This method is for advanced/internal use.
-
write
public ByteBuffer write(Object obj, int remainingRowLength, ByteOrder order) throws IOException
Serialize an Object into a raw byte value for this column- Parameters:
obj- Object to serializeorder- Order in which to serialize- Returns:
- A buffer containing the bytes
- Throws:
IOException- Usage:
- Advanced: This method is for advanced/internal use.
-
decodeUncompressedText
public static String decodeUncompressedText(byte[] textBytes, Charset charset)
- Parameters:
textBytes- bytes of text to decodecharset- relevant charset- Returns:
- the decoded string
- Usage:
- Advanced: This method is for advanced/internal use.
-
encodeUncompressedText
public static ByteBuffer encodeUncompressedText(CharSequence text, Charset charset)
- Parameters:
text- Text to encodecharset- database charset- Returns:
- A buffer with the text encoded
- Usage:
- Advanced: This method is for advanced/internal use.
-
countVariableLength
public static short countVariableLength(List<ColumnBuilder> columns)
- Parameters:
columns- A list of columns in a table definition- Returns:
- The number of variable length columns found in the list
- Usage:
- Advanced: This method is for advanced/internal use.
-
toCharSequence
public static CharSequence toCharSequence(Object value) throws IOException
- Returns:
- an appropriate CharSequence representation of the given object.
- Throws:
IOException- Usage:
- Advanced: This method is for advanced/internal use.
-
toByteArray
public static byte[] toByteArray(Object value) throws IOException
- Returns:
- an appropriate byte[] representation of the given object.
- Throws:
IOException- Usage:
- Advanced: This method is for advanced/internal use.
-
toBooleanValue
public static boolean toBooleanValue(Object obj)
Interpret a boolean value (null == false)- Usage:
- Advanced: This method is for advanced/internal use.
-
rawDataWrapper
public static com.healthmarketscience.jackcess.impl.ColumnImpl.RawData rawDataWrapper(byte[] bytes)
Returns a wrapper for raw column data that can be written without understanding the data. Useful for wrapping unparseable data for re-writing.
-
isRawData
public static boolean isRawData(Object value)
Returnstrueif the given value is "raw" column data,falseotherwise.- Usage:
- Advanced: This method is for advanced/internal use.
-
toInternalValue
public static Object toInternalValue(DataType dataType, Object value, DatabaseImpl db) throws IOException
Converts the given value to the "internal" representation for the given data type.- Throws:
IOException
-
-