The mi_interval_compare() function

The mi_interval_compare() function compares two binary (internal) INTERVAL values and returns an integer value that indicates whether the first value is before, equal to, or after the second value.

Syntax

mi_integer
mi_interval_compare(mi_interval *inv1, mi_interval *inv2, 
                    mi_integer *result)
inv1
is a pointer to an internal INTERVAL representation of the interval value.
inv2
is a pointer to an internal INTERVAL representation of the interval value.
result
is a pointer to the result of the comparison.
Valid in client LIBMI application? Valid in user-defined routine?
No Yes

Usage

Use the mi_interval_compare() function to compare the two interval values. If successful, the function returns MI_OK and sets the result variable to one of the following values:
-2
indicates that one or both of the INTERVAL values passed are NULL and cannot be compared.
-1
indicates that the value of inv1 is before the value of inv2.
0
indicates that the value of inv1 is equal to the value of inv2.
1
indicates that the value of inv1 is after the value of inv2.

Return values

MI_OK
indicates that the function was successful and that the value of the result variable was set.
-7520
indicates that one of the arguments passed is a NULL pointer.
-1263
indicates that a field in an INTERVAL data type is out of range, incorrect, or missing.
-1266
indicates that the INTERVAL values are incompatible for the operation.
-1268
indicates that there is an invalid INTERVAL qualifier.