The smart-large-object interface provides data type structures that store information about a smart large object. Table 28 summarizes the data type structures of the smart-large-object interface.
These structures are all opaque to a DataBlade API module; that is, you do not access their fields directly but instead use accessor functions that the smart-large-object interface provides.
The LO-specification structure, MI_LO_SPEC, defines the storage characteristics for an existing or a new smart large object. The storage characteristics provide information about features of the smart large object and how to store it on disk. For a description of the storage characteristics available, see Storage Characteristics.
The following table summarizes the memory operations for an LO-specification structure.
Memory Duration | Memory Operation | Function Name |
---|---|---|
Current memory duration | Constructor | mi_lo_spec_init( ) |
Destructor | mi_lo_spec_free( ) |
To access an LO-specification structure in a DataBlade API module, declare a pointer to an MI_LO_SPEC structure. For example, the following line shows the valid syntax of a variable that accesses an LO-specification structure:
MI_LO_SPEC *myspec; /* valid syntax */
Declaration of a flat LO-specification structure generates a compile error. The following line shows invalid syntax for an LO-specification structure:
MI_LO_SPEC myspec; /* INVALID syntax */
The milo.h header file defines the MI_LO_SPEC data type. Therefore, you must include the milo.h (or mi.h) file in DataBlade API modules that access this structure. For information on how to use an LO-specification structure, see Obtaining the LO-Specification Structure.
An LO handle, MI_LO_HANDLE, serves as a reference to a smart large object. It is analogous to the filename of an operating-system file in that it is a unique identifier of a smart large object. The LO handle contains encoded information about the smart large object, such as its physical disk location and other security-related information. After a smart large object is created, an associated LO handle is a valid reference for the life of that smart large object.
The following table summarizes the memory operations for an LO handle.
To access an LO handle in a user-defined routine (UDR), declare it in one of the following ways:
MI_LO_HANDLE *my_LOhndl; /* an LO-handle pointer */
When you declare an LO handle in this way, you must allocate memory for it before you use it. For more information, see Obtaining an LO Handle.
MI_LO_HANDLE my_flat_LOhnld; /* a flat LO handle */
When you declare a flat MI_LO_HANDLE structure, you do not need to allocate memory for it. This flat structure is useful when you need to embed an LO handle within an opaque data type.
The milo.h header file defines the MI_LO_HANDLE data type. Therefore, you must include the milo.h (or mi.h) file in DataBlade API modules that access this handle. For information on how to use an LO handle, see Initializing an LO-Specification Structure and Selecting the LO Handle.
The LO file descriptor, MI_LO_FD, is a reference to an open smart large object. An LO file descriptor is similar to a file descriptor for an operating-system file. It is an integer number that serves as a transient descriptor for performing I/O on the data of the smart large object. It provides the following information about an open smart large object:
When you first open a smart large object, the seek position is at byte zero (0).
You specify the open mode when you open a smart large object. For more information, see Open-Mode Information.
The following table summarizes the memory operations for an LO file descriptor.
To access an LO file descriptor in a DataBlade API module, declare a variable with the MI_LO_FD data type. For example, the following line declares the variable my_lofd that is an LO file descriptor:
MI_LO_FD my_lofd;
The milo.h header file defines the MI_LO_FD data type. Therefore, you must include the milo.h (or mi.h) file in DataBlade API modules that access this handle.
Because you declare an LO file descriptor directly, its scope is that of the variable you declare to hold it. When you assign an LO file descriptor to a local variable, the LO file descriptor is deallocated when the function that declares it ends. If you want to keep the LO file descriptor longer, you can allocate user memory with the memory duration you want (up to the advanced duration of PER_SESSION) and copy the LO file descriptor into this memory. For example, you could assign the LO file descriptor to PER_COMMAND memory and copy it into the user state of the MI_FPARAM structure. For more information, see Managing the Memory Duration and Saving a User State.
For information on how to use an LO file descriptor, see Initializing an LO-Specification Structure.
The LO-status structure, MI_LO_STAT, contains the status information for an existing smart large object. The following table summarizes the memory operations for an LO-status structure.
Memory Duration | Memory Operation | Function Name |
---|---|---|
Current memory duration | Constructor | mi_lo_stat( ) |
Destructor | mi_lo_stat_free( ) |
To access an LO-status structure in a DataBlade API module, declare a pointer to an MI_LO_STAT structure. For example, the following line declares the variable mystat that points to an LO-specification structure:
MI_LO_STAT *mystat; /* valid syntax */
Declaration of a flat LO-status structure generates a compile error. The following line shows invalid syntax for an LO-status structure:
MI_LO_STAT mystat; /* INVALID syntax */
The milo.h header file defines the MI_LO_STAT data type. Therefore, you must include the milo.h (or mi.h) file in DataBlade API modules that access this structure. For information on how to allocate and use an LO-status structure, see Obtaining Status Information.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]