The database server calls the input function when it receives the external representation of an opaque type from a client application. For example, when a client application issues an INSERT or UPDATE statement, it can send the text representation of an opaque type to the database server to be stored in an opaque-type column. The database server calls the input function to convert this external representation to an internal representation that it stores on disk.
Figure 11 shows when the database server executes the input support function.
If the opaque data type is pass by reference, the input support function should perform the following tasks:
The function can use the mi_alloc() DataBlade API function to allocate the space for the internal structure.
It must obtain the individual members from the input string and store them in the appropriate fields of the internal structure
If the opaque data type is pass by value, the input support function should perform these same basic tasks but return the actual value in the internal structure instead of a pointer to this structure. You can use pass by value only for opaque types that are less than 4 bytes in length.
The input function takes an mi_lvarchar value as an argument and returns the internal structure for the opaque type. The following function signature is an input support function for a fixed-length opaque data type whose internal structure is ll_longlong_t:
ll_longlong_t * ll_longlong_input(mi_lvarchar *extrnl_format);
The ll_longlong_input() function is a cast function from the LVARCHAR data type to the ll_longlong_t internal structure. It must be registered as an implicit cast function with the CREATE IMPLICIT CAST statement. For more information on cast functions, see Creating Casts for Opaque Data Types.