Home |
Previous Page | Next Page Appendix C. Mapping Data Types > Data Type Mapping for UDT Manager and UDR Manager >
The following table shows the mapping supported between
the types defined for the ifxtype parameter
in the UDTMetaData.setFieldType() method
and the Java data types as they appear in the Java class file. Data
types not shown in this table are not supported within the opaque
type.
- ifxtype Parameter
Type from
com.informix.lang.IfxTypes
- Java Data Type
- IFX_TYPE_CHAR
- java.lang.String
- IFX_TYPE_SMALLINT
- short
- IFX_TYPE_INT
- int
- IFX_TYPE_FLOAT
- double
- IFX_TYPE_SMFLOAT
- float1
- IFX_TYPE_DECIMAL
- java.lang.BigDecimal
- IFX_TYPE_SERIAL
- int
- IFX_TYPE_DATE
- Date
- IFX_TYPE_MONEY
- java.lang.BigDecimal
- IFX_TYPE_DATETIME
- java.lang.Timestamp if starting qualifier is Year, Month,
or Day; otherwise, java.lang.Time (see Field Lengths and Date-Time Data).
- IFX_TYPE_INTERVAL
- com.informix.lang.IfxIntervalYM if starting qualifier is Year
or Month; otherwise, com.informix.lang.IfxIntervalDF (see Field Lengths and Date-Time Data).
- IFX_TYPE_NCHAR
- java.lang.String
- IFX_TYPE_INT8
- long
- IFX_TYPE_SERIAL8
- long
- IFX_TYPE_BOOL
- boolean
- IFX_TYPE_CLOB
- java.sql.Clob
- IFX_TYPE_BLOB
- java.sql.Blob
1 This mapping is JDBC compliant.
You can map IFX_TYPE_SMFLOAT data type (via the JDBC FLOAT data
type) to the Java double data type for backward compatibility by
setting the IFX_GET_SMFLOAT_AS_FLOAT environment variable to 1.
Field Lengths and Date-Time Data
When you set a field type to a date-time or interval data
type by calling setFieldType(IFX_TYPE_DATETIME) or setFieldType(IFX_TYPE_INTERVAL),
the driver maps the date-time field to either java.sql.Timestamp or java.sql.Time,
depending on the encoded length you set by calling setFieldLength().
For example, given that the standard format for a date-time field
is YYYY-MM-DD HH:MM:SS,
the driver uses the following mapping algorithm:
- If the encoded length has the start code from hour or
less, it is mapped to java.sql.Time.
- If the encoded length has the start code from year or
less, it is mapped to java.sql.TimeStamp.
For intervals, the standards are either YYYY-MM or DD HH:MM:SS.frac.
The mapping is as follows:
- If the encoded length has the start code from day or
less, it is mapped to com.informix.jdbc.IfxIntervalDF.
- If the encoded length has the start code from year or
less, it is mapped to com.informix.jdbc.IfxIntervalYM.
Home |
[ Top of Page | Previous Page | Next Page | Contents |
Index ]