Home | Previous Page | Next Page   Function Descriptions >

mi_set_varlen( )

The mi_set_varlen( ) accessor routine sets the length of the data in a varying-length structure (such as mi_lvarchar).

Syntax

void mi_set_varlen(varlen_ptr, data_len)
   mi_lvarchar *varlen_ptr;
   mi_integer data_len;
varlen_ptr
is a pointer to the varying-length structure.
data_len
is the length of the data to store in the varying-length descriptor.
Valid in Client LIBMI Application? Valid in User-Defined Routine?
Yes Yes

Usage

The mi_set_varlen( ) function sets the data length to data_len in the varying-length structure that varlen_ptr references. Uses for mi_set_varlen( ) include:

Important:
The varying-length structure that "varlen_ptr" references is an opaque structure. Do not access fields of this structure directly. Instead, use mi_set_vardata( ) to set the data length in this structure.

The mi_set_varlen( ) function sets the data length in the varying-length descriptor. If you specify a data length larger than the current data portion, this function does not reallocate the data portion. Therefore, when you change the data length with mi_set_varlen( ), make sure that the new value does not exceed the size of the data portion.

The data in a varying-length structure is not null terminated. Make sure that you use mi_set_varlen( ) to set the length of the actual varying-length data, not including any null terminator.

Although the varlen_ptr argument is declared as a pointer to an mi_lvarchar value, you can also use the mi_set_varlen( ) function to set data length in other varying-length data types, such as mi_sendrecv.

Return Values

None.

Related Topics

See also the descriptions of mi_get_varlen( ), mi_new_var( ), mi_set_vardata( ), mi_set_vardata_align( ), mi_set_varptr( ), and mi_var_free( ).

For information on when to set the length of a varying-length structure, see the IBM Informix: DataBlade API Programmer's Guide.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]