The mi_put_smallint() function

The mi_put_smallint() function copies an mi_smallint (SMALLINT) value, converting any difference in alignment or byte order on the server computer to that of the client computer.

Syntax

mi_unsigned_char1 *mi_put_smallint (data_ptr, smallint_val)
   mi_unsigned_char1 *data_ptr;
   mi_integer smallint_val;
data_ptr
The address of the buffer to which to copy an mi_smallint value.
smallint_val
The promoted mi_smallint value to copy.
Valid in client LIBMI application? Valid in user-defined routine?
No Yes

Usage

The mi_put_smallint() function copies the mi_smallint value from the buffer that smallint_val references into the user-defined buffer that data_ptr references. Upon completion, mi_put_smallint() returns the address of the next position to which data can be copied in the data_ptr buffer. The function returns the data_ptr address advanced by nbytes bytes, ready for copying in the next value. In other words, if n is the length of the value that smallint_val identifies, the returned address is n bytes advanced from the original buffer address in data_ptr.

For maximum portability, this function accepts a fully promoted mi_integer value instead of an mi_smallint value. This argument might therefore require casting.

The mi_put_smallint() function is useful in a send support function of an opaque data type that contains an mi_smallint value. Use this function to send an mi_smallint field of an opaque-type internal structure to a client application (which possibly has unaligned data buffers).

For more information about the use of mi_put_smallint() in a send support function, see the HCL OneDB™ DataBlade® API Programmer's Guide.

Return values

An mi_unsigned_char1 pointer
The new address in the data_ptr data buffer.
NULL
The function was not successful.