The mi_type_precision() function

The mi_type_precision() function obtains the precision of a data type from its type descriptor.

Syntax

mi_integer mi_type_precision(type_desc)
   MI_TYPE_DESC *type_desc;
type_desc
A pointer to the type descriptor from which to obtain the precision.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_type_precision() function obtains the data type precision from the type descriptor that type_desc references. The precision is an attribute of the data type that represents the total number of digits the data type can hold, as follows.
DECIMAL, MONEY
Number of significant digits in the fixed-point or floating-point (DECIMAL) column
DATETIME, INTERVAL
Number of digits that are stored in the date, time, or date and time column with a specified qualifier
Character, Varying-character
Maximum number of characters in the column

If you call mi_type_precision() on some other data type, the function returns zero.

For information about type-descriptor accessor functions or about precision and scale, see the Informix® DataBlade® API Programmer's Guide.

Return values

>=0
The precision of the data type in type_desc.
MI_ERROR
The function was not successful.