Output support function
The database server calls the output function when it sends the external representation of an opaque type to a client application. For example, when a client application issues a SELECT or FETCH statement, the application can save the data of an opaque type that it receives from the database server in a character host variable. The database server calls the output function to convert the internal representation that is stored on disk to the external representation that the character host variable requires.
- Accept a pointer to the internal representation as an argument.
- Allocate enough space to hold the external representation.
The support function can use the mi_alloc() function to allocate the space for the character string. For more information about memory management and the mi_alloc() function, refer to the HCL OneDB™ DataBlade® API Programmer's Guide and the HCL OneDB DataBlade API Function Reference.
- Create the output string from the individual members of the internal
structure.
The function must build the external representation with the values from the appropriate fields of the internal structure.
- Return a pointer to the character string.
If the opaque data type is pass by value, the output support function should perform the same basic tasks but accept the actual value in the internal structure. You can use pass by value only for opaque types that are 4 bytes or less.
mi_lvarchar * ll_longlong_output(ll_longlong_t *intrnl_format);
The ll_longlong_output() function is a cast function from the ll_longlong_t internal structure to the LVARCHAR data type. It must be registered as an explicit cast function with the CREATE EXPLICIT CAST statement. For more information about cast functions, see Create casts for opaque data types.