To create a smart large object and save its LO handle in the database, you need to take the following steps. For details on a step, see the page listed under "More Information."
Step | Task | Smart-Large-Object Function | More Information |
---|---|---|---|
1. | Obtain an LO-specification structure to hold the storage characteristics for the new smart large object. | mi_lo_spec_init( ), mi_lo_stat_cspec( ) | page Obtaining the LO-Specification Structure |
2. | Ensure that the LO-specification structure contains the desired storage characteristics for the new smart large object. | System-specified storage characteristics:
mi_lo_spec_init( ) Column-level storage characteristics:
|
page Choosing Storage Characteristics |
3. | Create an LO handle for the new smart large object and open the smart large object. | mi_lo_create( ), mi_lo_expand( ), mi_lo_copy( ), mi_lo_from_file( ) | page Initializing an LO Handle and an LO File Descriptor |
4. | Write a specified number of bytes from a user-defined buffer to the open smart large object. | mi_lo_write( ), mi_lo_writewithseek( ) | page Writing Data to a Smart Large Object |
5. | Pass the LO handle as the column value for an INSERT or UPDATE statement. | C Casting | page Storing an LO Handle |
6. | Execute an INSERT or UPDATE statement to save the LO handle of the smart large object in a database column. | mi_exec( ), mi_exec_prepared_statement( ), mi_value( ) | page Storing an LO Handle |
7. | Close the smart large object. | mi_lo_close( ) | page Freeing a Smart Large Object |
8. | Free resources. | mi_lo_spec_free( ), mi_lo_release( ) | page Freeing Resources |
Figure 27 shows the first six of these steps that a DataBlade API module uses to insert the smart-large-object data into the emp_picture column of the employee table (Figure 26).