informix
Informix DataBlade API Programmer's Manual
DataBlade API Function Descriptions

mi_value()

The mi_value() function retrieves a column value from a row, given the column identifier.

Syntax

Usage

The mi_value() function returns the value for the column that the column_id column identifier specifies. It retrieves this column value from the row structure that row references. This function is typically called in a loop that terminates when mi_value() has retrieved values for all the columns in the row.

Important: The "value_buf" parameter points to the representation of the value that corresponds to the control mode of the query: a character string for text representation and the internal format for binary representation.

The way to interpret the data returned in the value_buf depends on the mi_value() return value, as follows.

Return Value From mi_value() Contents of value_buf
MI_NORMAL_VALUE A pointer to an MI_DATUM that holds the value for the column. The format of this value depends on:
  • Whether the control mode for the retrieved data is text or binary representation
  • In binary mode, whether the MI_DATUM value is passed by reference or by value
  • MI_ROW_VALUE A pointer to a row structure (MI_ROW).
    MI_COLLECTION_VALUE A pointer to a collection structure (MI_COLLECTION).
    MI_NULL_VALUE A pointer to a value that indicates the SQL NULL value for the column.

    The pointer returned in value_buf is valid until a new mi_exec() function is run or until the statement is dropped with mi_drop_prepared_statement(). However, the DataBlade API can overwrite the data when the mi_next_row() function is called on the same connection. If you need to save the data for later use, you must create your own copy of the data that value_buf references. For example, if the column is a character column, the data in value_buf is a pointer to an mi_lvarchar structure. To save the data in the mi_lvarchar structure, you can copy it with the mi_var_copy() function. You can use a save set to save an entire row.

    Return Values

    MI_NORMAL_VALUE indicates that the retbuf value is not a row type or a collection.
    MI_COLLECTION_VALUE

    indicates that the retbuf value is a pointer to a structure (MI_COLLECTION).

    MI_ROW_VALUE indicates that the retbuf value is a pointer to a row structure (MI_ROW).
    MI_NULL_VALUE indicates that the retbuf value is an SQL NULL value.
    MI_ERROR indicates that the function was not successful.

    Related Topics

    See the descriptions of the following functions: mi_collection_fetch(), mi_next_row(), mi_save_set_insert(), and mi_value_by_name().

    For more information about how to retrieve values, see Obtaining Column Values.


    Informix DataBlade API Programmer's Manual, Version 9.2
    Copyright © 1999, Informix Software, Inc. All rights reserved