The mi_column_id() function

The mi_column_id() function obtains the column identifier of a specified column from a row descriptor.

Syntax

mi_integer mi_column_id(row_desc, colname)
   MI_ROW_DESC *row_desc;
   mi_string *colname;
row_desc
A pointer to the row descriptor for the row that contains the specified column.
colname
A pointer to a null-terminated string to contain the column name.
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_id() function obtains a column identifier for either structure:
  • The column identifier of the colname column in the row
  • The column identifier of the colname field for the row type
A column identifier is the position of the column or field within the row descriptor. Column numbering follows C array-indexing conventions: the first column in the row is at position zero.
Tip: The system catalog tables refer to the unique number that identifies a column definition as its “column identifier.” However, the DataBlade® API refers to this number as a “column number” and the position of a column within the row structure as a “column identifier.” These two terms do not refer to the same value.

For more information about row descriptors, see the HCL OneDB™ DataBlade API Programmer's Guide.

Return values

>=0
The column position of the specified column or field in the specified row descriptor.
MI_ERROR
The function was not successful.