com.healthmarketscience.jackcess
Enum DataType

java.lang.Object
  extended by java.lang.Enum<DataType>
      extended by com.healthmarketscience.jackcess.DataType
All Implemented Interfaces:
Serializable, Comparable<DataType>

public enum DataType
extends Enum<DataType>

Supported access data types.

Author:
Tim McCune
Usage:
General: This class is general use.

Enum Constant Summary
BINARY
          Corresponds to a java byte[] of max length 255 bytes.
BOOLEAN
          Corresponds to a java Boolean.
BYTE
          Corresponds to a java Byte.
COMPLEX_TYPE
          Complex type corresponds to a special LONG autonumber field which is the key for a secondary table which holds the "real" data.
DOUBLE
          Corresponds to a java Double.
FLOAT
          Corresponds to a java Float.
GUID
          Corresponds to a java String with the pattern "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", also known as a "Replication ID" in Access.
INT
          Corresponds to a java Short.
LONG
          Corresponds to a java Integer.
MEMO
          Corresponds to a java String of max length 8388607 chars.
MONEY
          Corresponds to a java BigDecimal with at most 4 decimal places.
NUMERIC
          Corresponds to a java BigDecimal.
OLE
          Corresponds to a java byte[] of max length 16777215 bytes.
SHORT_DATE_TIME
          Corresponds to a java Date.
TEXT
          Corresponds to a java String of max length 255 chars.
UNKNOWN_0D
          Unknown data.
UNKNOWN_11
          Unknown data (seems to be an alternative OLE type, used by MSysAccessObjects table).
UNSUPPORTED_FIXEDLEN
          Dummy type for a fixed length type which is not currently supported.
UNSUPPORTED_VARLEN
          Placeholder type for a variable length type which is not currently supported.
 
Method Summary
static DataType fromByte(byte b)
           
static DataType fromSQLType(int sqlType)
           
static DataType fromSQLType(int sqlType, int lengthInUnits)
           
 int fromUnitSize(int unitSize)
           
 int getDefaultPrecision()
           
 int getDefaultScale()
           
 int getDefaultSize()
           
 int getFixedSize()
           
 int getFixedSize(Short colLength)
           
 boolean getHasScalePrecision()
           
 int getMaxPrecision()
           
 int getMaxScale()
           
 int getMaxSize()
           
 int getMinPrecision()
           
 int getMinScale()
           
 int getMinSize()
           
 int getSQLType()
           
 int getUnitSize()
           
 byte getValue()
           
 boolean isLongValue()
           
 boolean isMultipleAutoNumberAllowed()
           
 boolean isTextual()
           
 boolean isTrueVariableLength()
           
 boolean isUnsupported()
           
 boolean isValidPrecision(int precision)
           
 boolean isValidScale(int scale)
           
 boolean isValidSize(int size)
           
 boolean isVariableLength()
           
 boolean mayBeAutoNumber()
           
 int toUnitSize(int size)
           
 int toValidPrecision(int precision)
           
 int toValidScale(int scale)
           
 int toValidSize(int size)
           
static DataType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static DataType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

BOOLEAN

public static final DataType BOOLEAN
Corresponds to a java Boolean. Accepts Boolean or null (which is considered false). Equivalent to SQL Types.BOOLEAN.


BYTE

public static final DataType BYTE
Corresponds to a java Byte. Accepts any Number (using Number.byteValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, or null. Equivalent to SQL Types.TINYINT, Types.BIT.


INT

public static final DataType INT
Corresponds to a java Short. Accepts any Number (using Number.shortValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, or null. Equivalent to SQL Types.SMALLINT.


LONG

public static final DataType LONG
Corresponds to a java Integer. Accepts any Number (using Number.intValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, or null. Equivalent to SQL Types.INTEGER, Types.BIGINT.


MONEY

public static final DataType MONEY
Corresponds to a java BigDecimal with at most 4 decimal places. Accepts any Number (using Number.doubleValue()), a BigInteger, a BigDecimal (with at most 4 decimal places), Boolean as 1 or 0, any Object converted to a String and parsed as BigDecimal, or null. Equivalent to SQL Types.DECIMAL.


FLOAT

public static final DataType FLOAT
Corresponds to a java Float. Accepts any Number (using Number.floatValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, or null. Equivalent to SQL Types.FLOAT.


DOUBLE

public static final DataType DOUBLE
Corresponds to a java Double. Accepts any Number (using Number.doubleValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, or null. Equivalent to SQL Types.DOUBLE, Types.REAL.


SHORT_DATE_TIME

public static final DataType SHORT_DATE_TIME
Corresponds to a java Date. Accepts a Date, any Number (using Number.longValue()), or null. Equivalent to SQL Types.TIMESTAMP, Types.DATE, Types.TIME.


BINARY

public static final DataType BINARY
Corresponds to a java byte[] of max length 255 bytes. Accepts a byte[], or null. Equivalent to SQL Types.BINARY, Types.VARBINARY.


TEXT

public static final DataType TEXT
Corresponds to a java String of max length 255 chars. Accepts any CharSequence, any Object converted to a String , or null. Equivalent to SQL Types.VARCHAR, Types.CHAR.


OLE

public static final DataType OLE
Corresponds to a java byte[] of max length 16777215 bytes. Accepts a byte[], or null. Equivalent to SQL Types.LONGVARBINARY, Types.BLOB.


MEMO

public static final DataType MEMO
Corresponds to a java String of max length 8388607 chars. Accepts any CharSequence, any Object converted to a String , or null. Equivalent to SQL Types.LONGVARCHAR, Types.CLOB.


UNKNOWN_0D

public static final DataType UNKNOWN_0D
Unknown data. Handled like BINARY.


GUID

public static final DataType GUID
Corresponds to a java String with the pattern "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", also known as a "Replication ID" in Access. Accepts any Object converted to a String matching this pattern (surrounding "{}" are optional, so UUIDs are supported), or null.


NUMERIC

public static final DataType NUMERIC
Corresponds to a java BigDecimal. Accepts any Number (using Number.doubleValue()), a BigInteger, a BigDecimal, Boolean as 1 or 0, any Object converted to a String and parsed as BigDecimal, or null. Equivalent to SQL Types.NUMERIC.


UNKNOWN_11

public static final DataType UNKNOWN_11
Unknown data (seems to be an alternative OLE type, used by MSysAccessObjects table). Handled like a fixed length BINARY/OLE.


COMPLEX_TYPE

public static final DataType COMPLEX_TYPE
Complex type corresponds to a special LONG autonumber field which is the key for a secondary table which holds the "real" data.


UNSUPPORTED_FIXEDLEN

public static final DataType UNSUPPORTED_FIXEDLEN
Dummy type for a fixed length type which is not currently supported. Handled like a fixed length BINARY.


UNSUPPORTED_VARLEN

public static final DataType UNSUPPORTED_VARLEN
Placeholder type for a variable length type which is not currently supported. Handled like BINARY.

Method Detail

values

public static DataType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DataType c : DataType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static DataType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getValue

public byte getValue()

isVariableLength

public boolean isVariableLength()

isTrueVariableLength

public boolean isTrueVariableLength()

isLongValue

public boolean isLongValue()

getHasScalePrecision

public boolean getHasScalePrecision()

getFixedSize

public int getFixedSize()

getFixedSize

public int getFixedSize(Short colLength)

getMinSize

public int getMinSize()

getDefaultSize

public int getDefaultSize()

getMaxSize

public int getMaxSize()

getSQLType

public int getSQLType()
               throws SQLException
Throws:
SQLException

getMinScale

public int getMinScale()

getDefaultScale

public int getDefaultScale()

getMaxScale

public int getMaxScale()

getMinPrecision

public int getMinPrecision()

getDefaultPrecision

public int getDefaultPrecision()

getMaxPrecision

public int getMaxPrecision()

getUnitSize

public int getUnitSize()

toUnitSize

public int toUnitSize(int size)

fromUnitSize

public int fromUnitSize(int unitSize)

isValidSize

public boolean isValidSize(int size)

isValidScale

public boolean isValidScale(int scale)

isValidPrecision

public boolean isValidPrecision(int precision)

toValidSize

public int toValidSize(int size)

toValidScale

public int toValidScale(int scale)

toValidPrecision

public int toValidPrecision(int precision)

isTextual

public boolean isTextual()

mayBeAutoNumber

public boolean mayBeAutoNumber()

isMultipleAutoNumberAllowed

public boolean isMultipleAutoNumberAllowed()

isUnsupported

public boolean isUnsupported()

fromByte

public static DataType fromByte(byte b)
                         throws IOException
Throws:
IOException

fromSQLType

public static DataType fromSQLType(int sqlType)
                            throws SQLException
Throws:
SQLException

fromSQLType

public static DataType fromSQLType(int sqlType,
                                   int lengthInUnits)
                            throws SQLException
Throws:
SQLException


Copyright © 2005–2016 Health Market Science. All rights reserved.