Class ColumnImpl

  • All Implemented Interfaces:
    Column

    public class ColumnImpl
    extends Object
    implements Column
    Access database column definition
    Author:
    Tim McCune
    Usage:
    Intermediate: This class requires moderate API knowledge.
    • 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
      • 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, MSysComplexColumns included, 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. Only MSysObjects.Owner and MSysACEs.SID carry 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 table
        buffer - Buffer containing column definition
        offset - Offset in the buffer at which the column definition starts
        Throws:
        IOException
        Usage:
        Advanced: This method is for advanced/internal use.
      • 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.
      • isAutoNumber

        public boolean isAutoNumber()
        Specified by:
        isAutoNumber in interface Column
      • getColumnNumber

        public short getColumnNumber()
        Usage:
        Advanced: This method is for advanced/internal use.
      • getColumnId

        public short getColumnId()
        Description copied from interface: Column
        Returns 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:
        getColumnId in interface Column
      • isHidden

        public boolean isHidden()
        Description copied from interface: Column
        Returns whether or not ms access maintains this column and hides it. The columns of the system catalog tables, MSysComplexColumns included, and the replication columns do.
        Specified by:
        isHidden in interface Column
      • isSecurityIdentifier

        public boolean isSecurityIdentifier()
        Description copied from interface: Column
        Returns whether or not this column holds a windows security identifier. Only MSysObjects.Owner and MSysACEs.SID do.
        Specified by:
        isSecurityIdentifier in interface Column
      • 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.
      • getPrecision

        public byte getPrecision()
        Specified by:
        getPrecision in interface Column
      • getScale

        public byte getScale()
        Specified by:
        getScale in interface Column
      • 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.
      • getLength

        public short getLength()
        Specified by:
        getLength in interface Column
      • getLengthInUnits

        public final short getLengthInUnits()
        Specified by:
        getLengthInUnits in interface Column
      • isCalculated

        public boolean isCalculated()
        Description copied from interface: Column
        Returns 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:
        isCalculated in interface Column
      • isComplexValueForeignKey

        public boolean isComplexValueForeignKey()
        Returns true if 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: Column
        Whether or not this column is "append only" (its history is tracked by a separate version history column).
        Specified by:
        isAppendOnly in interface Column
      • getVersionHistoryColumn

        public ColumnImpl getVersionHistoryColumn()
        Description copied from interface: Column
        Returns the column which tracks the version history for an "append only" column.
        Specified by:
        getVersionHistoryColumn in interface Column
      • 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: Column
        Returns whether or not this is a hyperlink column (only possible for columns of type MEMO).
        Specified by:
        isHyperlink in interface Column
      • getColumnValidator

        public ColumnValidator getColumnValidator()
        Description copied from interface: Column
        Gets currently configured ColumnValidator (always non-null).
        Specified by:
        getColumnValidator in interface Column
      • setColumnValidator

        public void setColumnValidator​(ColumnValidator newValidator)
        Description copied from interface: Column
        Sets a new ColumnValidator. If null, resets to the value returned from the Database's ColumnValidatorFactory (if the factory returns null, then the default is used). Autonumber columns cannot have a validator instance other than the default.
        Specified by:
        setColumnValidator in interface Column
      • getAutoNumberGenerator

        public ColumnImpl.AutoNumberGenerator getAutoNumberGenerator()
        Returns the AutoNumberGenerator for this column if this is an autonumber column, null otherwise.
        Usage:
        Advanced: This method is for advanced/internal use.
      • 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 value
        order - 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 serialize
        order - 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 decode
        charset - 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 encode
        charset - 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)
        Returns true if the given value is "raw" column data, false otherwise.
        Usage:
        Advanced: This method is for advanced/internal use.