Specify additional field characteristics

The following methods set additional characteristics for fields in the internal data structure:
public void setFieldName (int field, String name) throws SQLException
public void setFieldType (int field, int ifxtype) throws SQLException
public void setFieldTypeName(int field, String sqltypename) throws SQLException
public void setFieldLength(int field, int length) throws SQLException

The field parameter indicates the field for which the driver should set or obtain a characteristic. The first field is 1; the second field is 2, and so forth.

The name you specify with setFieldName() appears in the Java class file. The following example sets the first field name to IMAGE.
mdata.setFieldName(1, "IMAGE");
The setFieldType() method sets the data type of a field using a constant from the file com.informix.lang.IfxTypes. For more information, see Mapping for field types. The following example specifies the CHAR data type for values in the third field:
mdata.setFieldType(3, com.informix.lang.IfxTypes.IFX_TYPE_CHAR); 
The setFieldTypeName() method sets the data type of a field using the SQL data type name:
mdata.setFieldTypeName(1, "IMAGE_UDT");

This method is valid only for opaque and distinct types; for other types, the driver ignores the information.

The length parameter has the following meanings, depending on the data type of the field:
Character types
Maximum length in characters
DATETIME
Encoded length
INTERVAL
Encoded length
Other data type or no type specified
Driver ignores the information

The possible values for encoded length are those in the JDBC 2.20 specification: hour to second; year to second; and year to fraction(1), year to fraction(2), up through year to fraction(5).

The following example specifies that the third (VARCHAR) field in an opaque type cannot store more than 24 characters:
mdata.setFieldLength(3, 24);