Obtain status information
After you have a valid LO-status structure, you can use the accessor functions to obtain the status information from this 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 Define 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(), mi_lo_stat_mtime_usec() |
Reference count | mi_lo_stat_refcnt() |
Size | mi_lo_stat_size() |
MI_CONNECTION *conn;
MI_LO_HANDLE *LO_hdl;
MI_LO_FD LO_fd;
MI_LO_STAT *LO_stat = NULL; /* DataBlade API allocates */
mi_integer ref_count, err;
...
/* Open the selected large object */
LO_fd = mi_lo_open(conn, LO_hdl, MI_LO_RDONLY);
if ( LO_fd == MI_ERROR )
/* handle error */
/* Allocate LO-specification structure and get status
* information for the opened smart large object
*/
if ( mi_lo_stat(conn, LO_fd, &LO_stat) != MI_OK )
/* handle error */
else
{
/* get reference count for this smart large object */
ref_count = mi_lo_stat_refcnt(LO_stat);
/* free the LO-status structure */
err = mi_lo_stat_free(LO_stat);
}
- Allocates a new LO-status structure because the value of *LO_stat is
NULL
The mi_lo_stat() function assigns a pointer to this new LO-status structure to the LO_stat variable.
- Initializes the LO_stat structure with the status information for the open smart large object that the LO file descriptor, LO_fd, identifies
After the LO-status structure contains the status information, the mi_lo_stat_refcnt() accessor function obtains the reference count from the LO-status structure and returns it into the ref_count variable. When the code no longer needs the LO-status structure, it frees this structure with the mi_lo_stat_free() function.