| Enum Constant and Description |
|---|
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.
|
| Modifier and Type | Field and Description |
|---|---|
private int |
_defaultPrecision
the default precision value
|
private int |
_defaultScale
the default scale value
|
private int |
_defaultSize
default size in bytes for var length columns
|
private java.lang.Integer |
_fixedSize
Size in bytes of fixed length columns
|
private boolean |
_hasScalePrecision
does this field have scale/precision
|
private boolean |
_longValue
is this a long value field
|
private int |
_maxPrecision
max precision value
|
private int |
_maxScale
max scale value
|
private int |
_maxSize
Max size in bytes for var length columns
|
private int |
_minPrecision
min precision value
|
private int |
_minScale
min scale value
|
private int |
_minSize
min in bytes size for var length columns
|
private java.lang.Integer |
_sqlType
SQL type equivalent, or null if none defined
|
private int |
_unitSize
the number of bytes per "unit" for this data type
|
private byte |
_value
Internal Access value
|
private boolean |
_variableLength
is this a variable length field
|
private static java.util.Map<java.lang.Integer,DataType> |
ALT_SQL_TYPES
Alternate map of SQL types to Access data types
|
private static java.util.Map<java.lang.Byte,DataType> |
DATA_TYPES |
private static java.util.Map<java.lang.Integer,DataType> |
SQL_TYPES
Map of SQL types to Access data types
|
| Modifier and Type | Method and Description |
|---|---|
private static void |
addNewSqlType(java.lang.String typeName,
DataType type,
DataType altType)
Adds mappings for a sql type which was added after jdk 1.5 (using
reflection).
|
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 |
isMultipleAutoNumberAllowed() |
boolean |
isTextual() |
boolean |
isTrueVariableLength() |
boolean |
isUnsupported() |
boolean |
isValidPrecision(int precision) |
boolean |
isValidScale(int scale) |
boolean |
isValidSize(int size) |
boolean |
isVariableLength() |
private static boolean |
isWithinRange(int value,
int minValue,
int maxValue) |
boolean |
mayBeAutoNumber() |
int |
toUnitSize(int size) |
int |
toValidPrecision(int precision) |
private static int |
toValidRange(int value,
int minValue,
int maxValue) |
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.
|
public static final DataType BOOLEAN
Boolean. Accepts Boolean or null
(which is considered false). Equivalent to SQL Types.BOOLEAN.public static final DataType BYTE
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.public static final DataType INT
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.public static final DataType LONG
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.public static final DataType MONEY
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.public static final DataType FLOAT
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.public static final DataType DOUBLE
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.public static final DataType SHORT_DATE_TIME
Date. Accepts a Date, any Number
(using Number.longValue()), or null. Equivalent to SQL
Types.TIMESTAMP, Types.DATE, Types.TIME.public static final DataType BINARY
byte[] of max length 255 bytes. Accepts a
byte[], or null. Equivalent to SQL Types.BINARY,
Types.VARBINARY.public static final DataType TEXT
String of max length 255 chars. Accepts
any CharSequence, any Object converted to a String , or null. Equivalent to SQL Types.VARCHAR, Types.CHAR.public static final DataType OLE
byte[] of max length 16777215 bytes.
Accepts a byte[], or null. Equivalent to SQL
Types.LONGVARBINARY, Types.BLOB.public static final DataType MEMO
String of max length 8388607 chars.
Accepts any CharSequence, any Object converted to a String , or
null. Equivalent to SQL Types.LONGVARCHAR, Types.CLOB.public static final DataType GUID
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.public static final DataType NUMERIC
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.public static final DataType UNKNOWN_11
OLE type, used by
MSysAccessObjects table). Handled like a fixed length BINARY/OLE.public static final DataType COMPLEX_TYPE
LONG autonumber field
which is the key for a secondary table which holds the "real" data.public static final DataType UNSUPPORTED_FIXEDLEN
BINARY.private static final java.util.Map<java.lang.Integer,DataType> SQL_TYPES
private static final java.util.Map<java.lang.Integer,DataType> ALT_SQL_TYPES
private static java.util.Map<java.lang.Byte,DataType> DATA_TYPES
private final boolean _variableLength
private final boolean _longValue
private final boolean _hasScalePrecision
private final byte _value
private final java.lang.Integer _fixedSize
private final int _minSize
private final int _defaultSize
private final int _maxSize
private final java.lang.Integer _sqlType
private final int _minScale
private final int _defaultScale
private final int _maxScale
private final int _minPrecision
private final int _defaultPrecision
private final int _maxPrecision
private final int _unitSize
public static DataType[] values()
for (DataType c : DataType.values()) System.out.println(c);
public static DataType valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic byte getValue()
public boolean isVariableLength()
public boolean isTrueVariableLength()
public boolean isLongValue()
public boolean getHasScalePrecision()
public int getFixedSize()
public int getFixedSize(java.lang.Short colLength)
public int getMinSize()
public int getDefaultSize()
public int getMaxSize()
public int getSQLType()
throws java.sql.SQLException
java.sql.SQLExceptionpublic int getMinScale()
public int getDefaultScale()
public int getMaxScale()
public int getMinPrecision()
public int getDefaultPrecision()
public int getMaxPrecision()
public int getUnitSize()
public int toUnitSize(int size)
public int fromUnitSize(int unitSize)
public boolean isValidSize(int size)
public boolean isValidScale(int scale)
public boolean isValidPrecision(int precision)
private static boolean isWithinRange(int value,
int minValue,
int maxValue)
public int toValidSize(int size)
public int toValidScale(int scale)
public int toValidPrecision(int precision)
public boolean isTextual()
public boolean mayBeAutoNumber()
public boolean isMultipleAutoNumberAllowed()
public boolean isUnsupported()
private static int toValidRange(int value,
int minValue,
int maxValue)
public static DataType fromByte(byte b) throws java.io.IOException
java.io.IOExceptionpublic static DataType fromSQLType(int sqlType) throws java.sql.SQLException
java.sql.SQLExceptionpublic static DataType fromSQLType(int sqlType, int lengthInUnits) throws java.sql.SQLException
java.sql.SQLException