Storing an LO handle

The INSERT or UPDATE statement can store the LO handle of a smart large object into the CLOB, BLOB, or opaque-type column.

About this task

To store a smart large object in the database:

Procedure

  1. Provide the LO handle to the INSERT or UPDATE statement, as follows:
    • For a CLOB or BLOB column, provide the LO handle as data for the column.
    • For an opaque-type column, store the LO handle in the internal structure of the opaque data type and pass this internal structure as data for the column.
  2. Execute the INSERT or UPDATE statement with a DataBlade® API function such as mi_exec() or mi_exec_prepared_statement().

Results

Tip: The data of the smart large object is stored when you write it to the sbspace of the smart large object.

When you save the LO handle in the CLOB or BLOB column, the smart-large-object optimizer increments the reference count of the smart large object by one. When you save the LO handle in an opaque-type column, the assign() support function for the opaque type must increment the reference count.

If you create a smart large object but do not store it in a database column, the smart large object is a transient smart large object. The database server does not guarantee that transient smart large objects remain valid once they are closed. When all references to the smart large objects are deleted, the database server deletes the smart large object.