The mi_set_vardata_align() function

The mi_set_vardata_align() accessor routine stores data in the data portion of a varying-length structure (such as mi_lvarchar) and adjusts for any initial padding required to align the data.

Syntax

void mi_set_vardata_align(varlen_ptr, data_ptr, align)
   mi_lvarchar *varlen_ptr;
   char *data_ptr;
   mi_integer align;
varlen_ptr
A pointer to the varying-length structure.
data_ptr
A pointer to the data to store in the data portion of the varying-length structure.
align
The nearest align-byte boundary on which to align the data.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_set_vardata_align() function copies the data that data_ptr references to the data field of the varying-length structure that varlen_ptr references. The function determines the number of bytes to copy from the data length information stored in the varlen_ptr varying-length structure. Therefore, use mi_set_varlen() to set the length of the data before you copy in the data.
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_align() to store aligned data in this structure.

The mi_set_vardata_align() function aligns the data on the nearest align-byte boundary. The function is useful for data types whose alignment is more stringent than the 4-byte alignment that the varying-length structure guarantees. For example, on some computer architectures, double-precision values might need to be stored on 64-bit boundaries. For opaque data types, this value must match the align column of the sysxtdtypes system catalog table.

The data in a varying-length structure is not null terminated. Do not copy the null terminator into the data portion of a varying-length structure.

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

Return values

None.