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

mi_set_vardata_align()

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

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 machine 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, 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.

Related Topics

See the description of the following functions: mi_get_vardata_align(), mi_new_var(), mi_set_vardata(), mi_set_varlen(), mi_set_varptr(), and mi_var_free().

For more information, see Storing Varying-Length Data.


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