Column values passed back to a client LIBMI application

The mi_value() and mi_value_by_name() functions pass back by reference column values for all data types; therefore, the returned MI_DATUM structure always contains a pointer to the actual value, never the value itself.

Even column values that can fit into an MI_DATUM structure are passed by reference. For example, a SMALLINT value can have the same value-buffer declaration as it would in a C UDR, as follows:
mi_integer *small_int_ptr;
Unlike a C UDR, however, the column value in the value buffer does not require a cast to create a copy:
small_int = *small_int_ptr;