informix
Informix DataBlade API Programmer's Manual
DataBlade API Function Descriptions

mi_lo_expand()

The mi_lo_expand() function copies multirepresentational data to a new smart large object.

Syntax

Usage

The mi_lo_expand() function performs the following steps to create a new smart large object that LOhdl_dptr references and copy multirepresentational data to a new smart large object:

  1. It obtains an LO handle for the new smart large object and assigns a pointer to the handle to the argument that LOhdl_dptr references.
  2. 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.

  3. It assigns the storage characteristics from the LO-specification structure, LO_spec, to the new smart large object.
  4. 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.

  5. It opens the new smart large object in the open mode that the flags argument specifies.
  6. The flag values for the flags argument indicate the mode of the smart large object after mi_lo_expand() successfully completes. For more information on valid open-mode flags, see Open Mode.

  7. It copies the contents of the multirepresentational data in the multirep_ptr buffer into the new smart large object that *LOhdl_dptr references.
  8. The mi_lo_expand() function copies multirep_len bytes of the multirepresentational data to the sbspace of the new smart large object.

  9. It returns an LO file descriptor that identifies the new smart large object and is positioned at the start of this smart large object.
  10. 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().

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 are not referenced by any columns (those with a reference count of zero (0)).

Tip: The mi_lo_expand() function replaces the mi_large_object_expand() function, which Informix supports for backward compatibility only. Use mi_lo_expand() for all new DataBlade API modules.

Return Values

MI_LO_FD is the LO file descriptor for the open smart large object that LOhdl_dptr references. The function also initializes the LO handle that LOhdl_dptr references.
MI_ERROR indicates that the function was not successful.

Related Topics

See the descriptions of the following functions: mi_lo_copy(), mi_lo_create(), mi_lo_from_file(), mi_lo_spec_init(), and mi_lo_open().

For more information, see Initializing an LO Handle and LO File Descriptor.


Informix DataBlade API Programmer's Manual, Version 9.2
Copyright © 1999, Informix Software, Inc. All rights reserved