Large Objects (BLOB/CLOB)¶
This document is written to give developers a quick introduction to the support for Large Objects in IFS Cloud.
The purpose of supporting Large Objects (LOBs) in IFS Cloud is to provide the ability to store Large Objects together with normal attributes in the database, e.g. XML documents, pictures or videos.
Type of LOBs¶
There are two Oracle LOB data types:
- Character Large Objects (CLOB)
Used for large texts (texts that can be larger than 4000 bytes).
- Binary Large Objects (BLOB)
Used for binary data (like pictures, sounds or videos).
LOBs in entity models¶
When adding LOB attributes to an entity, then this is carried out like any other attribute except for the data type. For Character Large Objects (CLOB), LONG_TEXT should be used, and for Binary Large Objects (BLOB), the data type should be BINARY.
The Framework generates all code to handle LOBs except for manually written files, like cdb and upg files.
Adding LOB columns to tables¶
If a LOB column should be added to an existing table, this is done by calling
Database_SYS.Add_Lob_Column from an upg or cdb script. Also, when adding new tables in upgrade scenarios the same method is used since a LOB column is always added separately after the table has been created. First the table with all columns except any LOB columns are created and after that, the LOB columns are added.
It is recommended to store all LOBs larger than 4000 bytes in a separate tablespace. In the tablespace provided templates (refer to Preparing Servers for more information), the IFSAPP_LOB tablespace is intended to be used for storing all LOBs. The default values for the other parameters needed when adding LOB columns are shown in the example below.
Changing LOB data¶
When changing a LOB from a client it is not possible to use the normal New_, Modify__ or Remove__, because the Attribute String cannot handle LOB data. Thus, when changing a LOB from a client one should call procedure Write_"attribute_name"__.
Note: The record interface for New___ and Modify___ handles LOB data since they are using the record interface.