Once you have a valid LO-status structure, you can use the accessor functions to obtain the status information from this structure. Table 42 shows the status information that an LO-status structure contains and the corresponding LO-status accessor functions.
| 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( ), mi_lo_stat_mtime_usec( ) |
| Reference count | mi_lo_stat_refcnt( ) |
| Size | mi_lo_stat_size( ) |
The following code fragment obtains the reference count from an LO-status structure that the LO_stat variable references:
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);
}
The mi_lo_open( ) function opens the smart large object that the LO handle, LO_hdl, identifies. The mi_lo_stat( ) function then obtains the status information for this open smart large object. The mi_lo_stat( ) function performs the following tasks:
The mi_lo_stat( ) function assigns a pointer to this new LO-status structure to the LO_stat variable.
Once 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.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]