The mi_column_precision() function

The mi_column_precision() function obtains the precision of the specified column from a row descriptor.

Syntax

mi_integer mi_column_precision(row_desc, column_id)
   MI_ROW_DESC *row_desc;
   mi_integer column_id;
row_desc
A pointer to the row descriptor of the row that contains the column.
column_id
The column identifier, which specifies the position of the column in the specified row descriptor. Column numbering follows C array-indexing conventions: the first column in the row is at position zero.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

A row descriptor can describe the structure of a row in a table or the structure of a row type. From the row descriptor that row_desc references, the mi_column_precision() function obtains the precision of a column for either structure:
  • The precision of the column at position column_id in the row
  • The precision of the field at position column_id for the row type
The precision is an attribute of the column data type and represents the total number of digits the column 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 and/or time column with the specified qualifier
Character, Varying-character
Maximum number of characters in the column

If you call mi_column_precision() on a column or row-type field of some other data type, the function returns zero.

For more information about row descriptors or about the precision of a fixed-point data type, see the Informix® DataBlade® API Programmer's Guide.

Return values

0
No precision was set for the specified column or field.
>0
The precision of the specified column or field.
MI_ERROR
The function was not successful.