The DataBlade API supports the following SQL data types that can hold information about date-time or interval values.
DataBlade API Date and Time Data Type | SQL Date and Time Data Type |
---|---|
mi_datetime | DATETIME |
mi_interval | INTERVAL |
The SQL DATETIME data type provides the internal (binary) format of a date-time value. This data type stores an instant in time expressed as a calendar date and time of day, just a calendar date, or just a time of day. You choose how precisely a DATETIME value is stored with a qualifier. The precision can range from a year to a fraction of a second. For a detailed description of the SQL DATETIME data type, see the IBM Informix: Guide to SQL Reference.
The DATETIME data type uses a computer-independent method to encode the date or time qualifiers. It stores the information in the dtime_t structure, as follows:
typedef struct dtime { short dt_qual; dec_t dt_dec; } dtime_t;
The dtime structure and dtime_t typedef have two parts, which the following table shows.
This field is a decimal value.
The DataBlade API supports the SQL DATETIME data type with the mi_datetime data type. Therefore, the mi_datetime data type holds the binary representation of a date and/or time value.
Values of the mi_datetime data type cannot fit into an MI_DATUM structure. They must be passed by reference within C UDRs.
All data types, including mi_datetime, must be passed by reference within client LIBMI applications.
Because the binary representation of a DATETIME (mi_datetime) value is an Informix-proprietary format, you cannot use standard system functions to perform operations on mi_datetime values. Instead, the DataBlade API provides the following support for the DATETIME data type.
Category of DATETIME Function | More Information |
---|---|
Conversion functions | Conversion of Date-Time or Interval Representations |
Arithmetic-operation functions | Operations on Date and Time Data |
The SQL INTERVAL data type holds the internal (binary) format of an interval value. It encodes a value that represents a span of time. INTERVAL types are divided into two classes: year-month intervals and day-time intervals. A year-month interval can represent a span of years and months, and a day-time interval can represent a span of days, hours, minutes, seconds, and fractions of a second. For a detailed description of the SQL INTERVAL data type, see the IBM Informix: Guide to SQL Reference.
The INTERVAL data type uses a computer-independent method to encode the interval qualifiers. It stores the information in the intrvl_t structure, as follows:
typedef struct intrvl { short in_qual; dec_t in_dec; } intrvl_t;
The intrvl structure and intrvl_t typedef have the two parts that Table 17 shows.
Field | Description |
---|---|
in_qual | The qualifier of the interval value |
in_dec | The digits of the fields of the interval value
This field is a decimal value. |
The DataBlade API supports the SQL INTERVAL data type with the mi_interval data type. Therefore, an mi_interval data type holds the binary representation of an interval value.
Values of the mi_interval data type cannot fit into an MI_DATUM structure. They must be passed by reference within C UDRs.
All data types, including mi_interval, must be passed by reference within client LIBMI applications.
Because the binary representation of an INTERVAL (mi_interval) value is an Informix-proprietary format, you cannot use standard system functions to perform operations on mi_interval values. Instead, the DataBlade API provides the following support for the INTERVAL data type.
Category of INTERVAL Function | More Information |
---|---|
Conversion functions | Conversion of Date-Time or Interval Representations |
Arithmetic-operation functions | Operations on Date and Time Data |