When an application retrieves or inserts a DATETIME or INTERVAL value, the DataBlade API module must ensure that the qualifier field of the variable is valid:
When a DataBlade API module uses an mi_datetime variable to fetch or insert a DATETIME value, the module must find a valid qualifier in the mi_datetime variable. The DataBlade API takes one the following actions, based on the value of the dt_qual field in the dtime_t structure that is associated with the variable:
Extending is the operation of adding or dropping fields of a DATETIME value to make it match a given qualifier. You can explicitly extend DATETIME values with the SQL EXTEND function and the dtextend( ) function.
Zero is an invalid qualifier. Therefore, if you set the dt_qual field to zero, you can ensure that the DataBlade API uses the qualifier of the DATETIME column.
The DataBlade API sets the SQLSTATE status variable to an error-class code (and SQLCODE to a negative value) and the update or insert operation on the DATETIME column fails.
When a DataBlade API module uses an mi_interval variable to fetch or insert an INTERVAL value, the DataBlade API must find a valid qualifier in the mi_interval variable. The DataBlade API takes one of the following actions, based on the value of the in_qual field the intrvl_t structure that is associated with the variable:
The two qualifiers are compatible if they belong to the same interval class: either year to month or day to fraction. If the qualifiers are incompatible, the DataBlade API sets the SQLSTATE status variable to an error-class code (and SQLCODE is set to a negative value) and the select, update, or insert operation fails.
If the qualifiers are compatible but not the same, the DataBlade API extends the column value to match the in_qual qualifier. Extending is the operation of adding or dropping fields within one of the interval classes of an INTERVAL value to make it match a given qualifier. You can explicitly extend INTERVAL values with the invextend( ) function.
The DataBlade API sets the SQLSTATE status variable to an error-class code (and SQLCODE is set to a negative value) and the update or insert operation on the INTERVAL column fails.
You can select a DATETIME or INTERVAL column value into a character variable. The DataBlade API converts the DATETIME or INTERVAL column value to a character string before it stores it in the character variable. This character string conforms to the ANSI SQL standards for DATETIME and INTERVAL values.
You can also insert a DATETIME or INTERVAL column value from a character variable. The DataBlade API uses the data type and qualifiers of the column value to convert the character value to a DATETIME or INTERVAL value. It expects the character string to contain a DATETIME or INTERVAL value that conforms to ANSI SQL standards.
If the conversion fails, the DataBlade API sets the SQLSTATE status variable to an error-class code (and SQLCODE status variable to a negative value) and the update or insert operation fails.