Accessing a smart large object
About this task
To access an existing smart large object in the database,
you need to perform the following steps.
Step | Task | Smart-large-object function | More information |
---|---|---|---|
1. | Execute a SELECT statement to obtain the LO handle of the smart large object from the CLOB or BLOB column. | mi_exec(), mi_exec_prepared_statement(), mi_value() | Selecting the LO handle |
2. | Convert the returned column value into an LO handle. | C Cast | Convert an LO handle between binary and text |
3. | Open the smart large object that the LO handle identifies and return a valid LO file descriptor. | mi_lo_open() | Open a smart large object |
4. | Read a specified number of bytes and store them in a user-defined buffer. | mi_lo_read(), mi_lo_readwithseek() | Read data from a smart large object |
5. | Close the smart large object. | mi_lo_close() | Free a smart large object |
6. | Free resources. | mi_lo_release() | Free resources |
The following figure shows the first four of these
steps that a DataBlade®
API module
uses to access the smart-large-object data from the emp_picture column
of the employee table (A smart large object in
a database column).