1.
Obtain a valid LO file descriptor for the smart large object whose status information you need.
mi_lo_create(), mi_lo_copy(), mi_lo_expand(), mi_lo_from_file()
mi_lo_open()
page 3-75
2.
Allocate and fill an LO-status structure.
mi_lo_stat()
page 3-76
3.
Use the appropriate LO-status accessor function to obtain the status information that you need.
Figure 3-21
page 3-77
4.
Deallocate resources.
mi_lo_stat_free()
page 3-80
Figure 3-20 shows the first three of these steps that a DataBlade routine uses to obtain status information for the smart large object data in the emp_picture column of the employee table (Figure 3-3).
Figure 3-20 Obtaining Status Information
Obtaining a Valid LO File Descriptor You can obtain status information for any smart large object for which you have a valid LO file descriptor. To obtain an LO file descriptor, perform any of the following steps:
2. It initializes the LO-status structure with all status information for the smart large object that the specified LO file descriptor identifies.
Accessing Status Information Once you have a valid LO-status structure, you can use the accessor functions to obtain the status information from this structure. Figure 3-21 shows the status information that an LO-status structure contains and the corresponding LO-status accessor functions.
Figure 3-21 Status Information in the LO-Status Structure Status Information LO-Status Accessor Function Last-access time This value is available only if the last-access time attribute (MI_LO_ATTR_KEEP_LASTACCESS_TIME) is set for this smart large object. mi_lo_stat_atime() Storage characteristics These characteristics are stored in an LO-specification structure. Use the LO-specification accessor functions (see "Defining User-Specified Storage Characteristics") to obtain information from this structure. mi_lo_stat_cspec() Last-change time mi_lo_stat_ctime() Last-modification time mi_lo_stat_mtime_sec() Reference count mi_lo_stat_refcnt() Size mi_lo_stat_size() Important: The LO-status structure, MI_LO_STAT, is an opaque structure to DataBlade routines. Do not access its internal structure directly. Informix does not guarantee that the internal structure of MI_LO_STAT will not change in future releases. Therefore, to create portable code, always use the LO-status accessor functions for this structure. The following code fragment obtains the reference count from an LO-status structure that the LO_stat variable references:
Last-access time
This value is available only if the last-access time attribute (MI_LO_ATTR_KEEP_LASTACCESS_TIME) is set for this smart large object.
mi_lo_stat_atime()
Storage characteristics
These characteristics are stored in an LO-specification structure. Use the LO-specification accessor functions (see "Defining User-Specified Storage Characteristics") to obtain information from this structure.
mi_lo_stat_cspec()
Last-change time
mi_lo_stat_ctime()
Last-modification time
mi_lo_stat_mtime_sec()
Reference count
mi_lo_stat_refcnt()
Size
mi_lo_stat_size()
2. Initializes the LO_stat structure with the status information for the open smart large object that the LO file descriptor, LO_fd, identifies.