Elexis API documentation
Version 2.1.6 as of December 11 2011

com.healthmarketscience.jackcess
Enum DataType

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

public enum DataType
extends java.lang.Enum<DataType>

Access data type

Author:
Tim McCune

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.
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).
 
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(java.lang.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 isTrueVariableLength()
           
 boolean isValidPrecision(int precision)
           
 boolean isValidScale(int scale)
           
 boolean isValidSize(int size)
           
 boolean isVariableLength()
           
 int toUnitSize(int size)
           
 int toValidPrecision(int precision)
           
 int toValidScale(int scale)
           
 int toValidSize(int size)
           
static DataType valueOf(java.lang.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.

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(java.lang.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:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.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(java.lang.Short colLength)

getMinSize

public int getMinSize()

getDefaultSize

public int getDefaultSize()

getMaxSize

public int getMaxSize()

getSQLType

public int getSQLType()
               throws java.sql.SQLException
Throws:
java.sql.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)

fromByte

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

fromSQLType

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

fromSQLType

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

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis