MI_LO_FD mi_lo_expand(conn, LOhdl_dptr, multirep_ptr, multirep_len, open_mode, LO_spec) MI_CONNECTION *conn; MI_LO_HANDLE **LOhdl_dptr; MI_MULTIREP_DATA *multirep_ptr; mi_integer multirep_len; mi_integer open_mode; MI_LO_SPEC *LO_spec;
A pointer to a connection descriptor established by a previous call to mi_open( ), mi_server_connect( ), or mi_server_reconnect( )
A NULL-valued pointer (database server only)
Valid in Client LIBMI Application? | Valid in User-Defined Routine? |
---|---|
Yes | Yes |
The mi_lo_expand( ) function performs the following steps to create a new smart large object that LOhdl_dptr references and to copy multirepresentational data into this new smart large object:
If the LOhdl_dptr argument is NULL, mi_lo_expand( ) allocates a new LO handle for the new smart large object and assigns a pointer to this handle to LOhdl_dptr. If LOhdl_dptr is not NULL, mi_lo_expand( ) assumes that you have already allocated an LO handle and uses the LOhdl_ptr argument to locate the LO handle for the new smart large object.
If the LO-specification structure has not been updated with storage characteristics (the associated fields are null), the mi_lo_expand( ) function uses the system-specified storage characteristics.
If the LO-specification structure was updated with storage characteristics, mi_lo_expand( ) uses the storage characteristics that the LO-specification structure defines for the new smart large object.
The bitmask value for the open_mode argument indicates the open mode of the smart large object after mi_lo_expand( ) successfully completes. For more information on valid open-mode flags, see the IBM Informix: DataBlade API Programmer's Guide.
The mi_lo_expand( ) function copies multirep_len bytes of the multirepresentational data to the sbspace of the new smart large object.
When the mi_lo_expand( ) function is successful, it returns a valid LO file descriptor. You can then use this file descriptor to identify which smart large object to access in subsequent function calls, such as mi_lo_read( ) and mi_lo_write( ).
The mi_lo_expand( ) function is a constructor function for both an LO file descriptor and an LO handle.
If the mi_lo_expand( ) function allocates an LO handle, it allocates this LO handle in the current memory duration. The mi_lo_expand( ) function does not allocate memory for the LO file descriptor. Your UDR can assign this LO file descriptor to user memory with a desired memory duration.
Each mi_lo_expand( ) call is implicitly associated with the current session. When this session ends, the database server deallocates any smart large objects that mi_lo_expand( ) has created if its LO handle has not been stored in a column (its reference count is zero) and no open LO file descriptors exist for the smart large object.
The mi_lo_expand( ) function does not need a connection descriptor to execute. If your UDR does not need a valid connection for other operations, you can specify a NULL-valued pointer for the conn parameter to establish a NULL connection. For information on the advantages of a NULL connection, see the IBM Informix: DataBlade API Programmer's Guide.
See also the descriptions of mi_lo_copy( ), mi_lo_create( ), mi_lo_from_file( ), mi_lo_spec_init( ), mi_lo_open( ), and mi_set_large( ).