Package com.healthmarketscience.jackcess
Enum DataType
- java.lang.Object
-
- java.lang.Enum<DataType>
-
- 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
Enum Constants Enum Constant Description BIG_BINARYA fixed length binary column longer than the 255 byteBINARY, which the engine calls "BigBinary".BIG_INTCorresponds to a javaLong.BINARYCorresponds to a javabyte[]of max length 255 bytes.BOOLEANCorresponds to a javaBoolean.BYTECorresponds to a javaByte.COMPLEX_TYPEComplex type corresponds to a specialLONGautonumber field which is the key for a secondary table which holds the "real" data.DOUBLECorresponds to a javaDouble.EXT_DATE_TIMECorresponds to a javaLocalDateTime(with 7 digits of nanosecond precision).FLOATCorresponds to a javaFloat.GUIDCorresponds to a javaStringwith the pattern"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}", also known as a "Replication ID" in Access.INTCorresponds to a javaShort.LONGCorresponds to a javaInteger.MEMOCorresponds to a javaStringof max length 8388607 chars.MONEYCorresponds to a javaBigDecimalwith at most 4 decimal places.NUMERICCorresponds to a javaBigDecimal.OLECorresponds to a javabyte[]of max length 16777215 bytes.SHORT_DATE_TIMECorresponds to a javaDateorLocalDateTime.TEXTCorresponds to a javaStringof max length 255 chars.UNSUPPORTED_FIXEDLENDummy type for a fixed length type which is not currently supported.UNSUPPORTED_VARLENPlaceholder type for a variable length type which is not currently supported.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DataTypefromByte(byte b)static DataTypefromSQLType(int sqlType)static DataTypefromSQLType(int sqlType, int lengthInUnits)static DataTypefromSQLType(int sqlType, int lengthInUnits, Database.FileFormat fileFormat)intfromUnitSize(int unitSize)intfromUnitSize(int unitSize, JetFormat format)intgetDefaultPrecision()intgetDefaultScale()intgetDefaultSize()intgetFixedSize()intgetFixedSize(Short colLength)booleangetHasScalePrecision()intgetMaxPrecision()intgetMaxScale()intgetMaxSize()intgetMinPrecision()intgetMinScale()intgetMinSize()intgetSQLType()intgetUnitSize()intgetUnitSize(JetFormat format)bytegetValue()booleanisLongValue()booleanisMultipleAutoNumberAllowed()booleanisTextual()booleanisTrueVariableLength()booleanisUnsupported()booleanisValidPrecision(int precision)booleanisValidScale(int scale)booleanisValidSize(int size)booleanisVariableLength()booleanmayBeAutoNumber()inttoUnitSize(int size)inttoUnitSize(int size, JetFormat format)inttoValidPrecision(int precision)inttoValidScale(int scale)inttoValidSize(int size)static DataTypevalueOf(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.
-
-
-
Enum Constant Detail
-
BOOLEAN
public static final DataType BOOLEAN
Corresponds to a javaBoolean. Accepts Boolean ornull(which is consideredfalse). Equivalent to SQLTypes.BOOLEAN.
-
BYTE
public static final DataType BYTE
Corresponds to a javaByte. Accepts anyNumber(usingNumber.byteValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, ornull. Equivalent to SQLTypes.TINYINT,Types.BIT.
-
INT
public static final DataType INT
Corresponds to a javaShort. Accepts anyNumber(usingNumber.shortValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, ornull. Equivalent to SQLTypes.SMALLINT.
-
LONG
public static final DataType LONG
Corresponds to a javaInteger. Accepts anyNumber(usingNumber.intValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, ornull. Equivalent to SQLTypes.INTEGER,Types.BIGINT.
-
MONEY
public static final DataType MONEY
Corresponds to a javaBigDecimalwith at most 4 decimal places. Accepts anyNumber(usingNumber.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, ornull. Equivalent to SQLTypes.DECIMAL.
-
FLOAT
public static final DataType FLOAT
Corresponds to a javaFloat. Accepts anyNumber(usingNumber.floatValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, ornull. Equivalent to SQLTypes.FLOAT.
-
DOUBLE
public static final DataType DOUBLE
Corresponds to a javaDouble. Accepts anyNumber(usingNumber.doubleValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, ornull. Equivalent to SQLTypes.DOUBLE,Types.REAL.
-
SHORT_DATE_TIME
public static final DataType SHORT_DATE_TIME
Corresponds to a javaDateorLocalDateTime. Accepts a Date, LocalDateTime (or related types), anyNumber(usingNumber.longValue()), ornull. Equivalent to SQLTypes.TIMESTAMP,Types.DATE,Types.TIME.
-
BINARY
public static final DataType BINARY
Corresponds to a javabyte[]of max length 255 bytes. Accepts abyte[], ornull. Equivalent to SQLTypes.BINARY,Types.VARBINARY.
-
TEXT
public static final DataType TEXT
Corresponds to a javaStringof max length 255 chars. Accepts anyCharSequence, any Object converted to a String , ornull. Equivalent to SQLTypes.VARCHAR,Types.CHAR.
-
OLE
public static final DataType OLE
Corresponds to a javabyte[]of max length 16777215 bytes. Accepts abyte[], ornull. Equivalent to SQLTypes.LONGVARBINARY,Types.BLOB.
-
MEMO
public static final DataType MEMO
Corresponds to a javaStringof max length 8388607 chars. Accepts anyCharSequence, any Object converted to a String , ornull. Equivalent to SQLTypes.LONGVARCHAR,Types.CLOB.
-
GUID
public static final DataType GUID
-
NUMERIC
public static final DataType NUMERIC
Corresponds to a javaBigDecimal. Accepts anyNumber(usingNumber.doubleValue()), aBigInteger, a BigDecimal, Boolean as 1 or 0, any Object converted to a String and parsed as BigDecimal, ornull. Equivalent to SQLTypes.NUMERIC.
-
BIG_BINARY
public static final DataType BIG_BINARY
A fixed length binary column longer than the 255 byteBINARY, which the engine calls "BigBinary". Only theDatacolumn ofMSysAccessObjectsuses it, which holds the forms, reports and VBA of the database. Jet4 only, since Jet3 usedBINARYfor that column and the ACE engine dropped the table. Handled like a fixed length BINARY/OLE.
-
COMPLEX_TYPE
public static final DataType COMPLEX_TYPE
Complex type corresponds to a specialLONGautonumber field which is the key for a secondary table which holds the "real" data.
-
BIG_INT
public static final DataType BIG_INT
Corresponds to a javaLong. Accepts anyNumber(usingNumber.longValue()), Boolean as 1 or 0, any Object converted to a String and parsed as Double, ornull. Equivalent to SQLTypes.BIGINT.
-
EXT_DATE_TIME
public static final DataType EXT_DATE_TIME
Corresponds to a javaLocalDateTime(with 7 digits of nanosecond precision). Accepts a Date, LocalDateTime (or related types), anyNumber(usingNumber.longValue()), ornull. Equivalent to SQLTypes.TIMESTAMP,Types.DATE,Types.TIME.
-
UNSUPPORTED_FIXEDLEN
public static final DataType UNSUPPORTED_FIXEDLEN
Dummy type for a fixed length type which is not currently supported. Handled like a fixed lengthBINARY.
-
-
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 nameNullPointerException- 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 IOException- Throws:
IOException
-
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()
-
getUnitSize
public int getUnitSize(JetFormat format)
-
toUnitSize
public int toUnitSize(int size)
-
toUnitSize
public int toUnitSize(int size, JetFormat format)
-
fromUnitSize
public int fromUnitSize(int unitSize)
-
fromUnitSize
public int fromUnitSize(int unitSize, JetFormat format)
-
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 IOException
- Throws:
IOException
-
fromSQLType
public static DataType fromSQLType(int sqlType, int lengthInUnits) throws IOException
- Throws:
IOException
-
fromSQLType
public static DataType fromSQLType(int sqlType, int lengthInUnits, Database.FileFormat fileFormat) throws IOException
- Throws:
IOException
-
-