Store a smart large object

The HCL OneDB™ ESQL/C program accesses a smart large object through an LO-pointer structure. The HCL OneDB ESQL/C library functions in the table from ESQL/C functions that use the LO-pointer structure accept an LO-pointer structure as an argument. Through the LO-pointer structure, these functions allow you to create and manipulate a smart large object without binding it to a database row.

An INSERT or UPDATE statement does not perform the actual input of the smart-large-object data. It does, however, provide a means for the application program to identify which smart-large-object data to associate with the column. A CLOB or BLOB column in a database table stores the LO-pointer structure for a smart large object. Therefore, when you store a CLOB or BLOB column, you provide an LO-pointer structure for the column in an ifx_lo_t host variable to the INSERT or UPDATE statement. For this reason, you declare host variables for CLOB and BLOB values as LO-pointer structures.

The following figure shows how the HCL OneDB ESQL/C client application transfers the data of a smart large object to the database server.
Figure 1: Transferring smart- large-object data from client application to database server

begin figure description - This figure is described in the surrounding text. - end figure description

The smart large object that an LO-pointer structure identifies exists as long as its LO-pointer structure exists. When you store an LO-pointer structure in the database, the database server can ensure that the smart large objects are deallocated when appropriate.

When you retrieve a row and then update a smart large object which that row contains, the database server exclusively locks the row for the time that it updates the smart large object. Moreover, long updates for smart large objects (whether logging is enabled and whether they are associated with a table row) create the potential for a long transaction condition if the smart large object takes a long time to update or create.

For an example of code that stores a new smart large object into a database column, see The create_clob.ec program. For information about how to select a smart large object from the database, see Select a smart large object.