Selecting the LO handle
The SELECT statement can select an LO handle of a smart large object from a CLOB, BLOB, or opaque-type column. Because the result of a query is usually the contents of an object, not just its LO handle, the DataBlade® API module must then use the LO handle that the mi_value() or mi_value_by_name() function returns to access the smart-large-object data in its sbspace.
About this task
To select a smart large object from the database:
Procedure
- Execute the SELECT statement with a DataBlade® API statement-execution function such as mi_exec() or mi_exec_prepared_statement().
- Obtain the column value that the mi_value() or mi_value_by_name() function
passes back in the MI_DATUM structure as appropriate for the
control mode of the query:
- For binary representation, the MI_DATUM structure contains a pointer to an LO handle.
- For text representation, the MI_DATUM structure contains the hexadecimal dump of an LO handle. To access the smart-large-object data, you must convert the LO handle to its binary representation with mi_lo_from_string().
- Optional: Ensure that the LO handle is valid with mi_lo_validate().