Handling large objects

When you decide on the specific data type to represent a DataBlade® module object-or its elements-keep in mind that the maximum row size for a database table is 32 KB. (Row size is the sum of the sizes of the columns in that row.)

Your HCL Informix® database server provides the LVARCHAR data type, which can hold up to 32,790 KB of text data. Larger objects and binary objects are called smart large objects, and your Informix database server provides facilities for high-performance access to smart large objects.

A smart large object is an object that is logically stored in a table column of type BLOB (binary large object, for binary data) or CLOB (character large object, for text data) but is physically stored in an sbspace.

An sbspace is a logical storage area that contains one or more chunks that store only BLOB and CLOB data. Sbspaces must be created before you can create any smart large objects; after sbspaces are created, they are managed by your Informix database server.
Tip: If your DataBlade module uses smart large objects, you can test for the existence of a particular sbspace when your DataBlade module is being registered in a database by using BladeManager.
Smart large objects are smart because they provide the following features:
  • They provide random access to their data by using an operating-system-style interface (seek, read, write, and so on).
  • They are recoverable in the event of a system crash (if the sbspace was created with logging enabled), and they obey transaction isolation modes.
  • They have no maximum size.
  • You can create and store indexes in them.
  • You can access and manipulate them using SQL, Informix ESQL/C, or the DataBlade API.

Within SQL, the only comparison operator you can use for data of types BLOB and CLOB is Equal() (=); however, you can perform additional operations by using Informix ESQL/C or the DataBlade API from your client application.

You can also use the Large Object Locator extension to handle large objects. This DataBlade module enables you to store large object data on the client computer. The Large Object Locator extension is included with your Informix database server. You must register the routines of the module and data types in each database in which you plan to use the module.

When you design data types, ask yourself the following questions:
  • Is the object represented by 32,790 KB or less of text data? If so, use the built-in LVARCHAR data type.
  • Is the object represented by more than 32,790 KB of text data, or by binary data? If so, use the smart large object facilities provided by your Informix database server.
  • Does it make sense to store the large object on the client computer? If so, use the Large Object Locator extension.
The following table lists large object topics and where you can find more information about them.
For information about... See...
Using smart large objects, including examples Informix Guide to SQL: Syntax
Overview of smart large objects Informix Guide to SQL: Tutorial
Creating sbspaces Informix Administrator's Guide
Testing for the existence of a particular sbspace during DataBlade module registration Test for an sbspace
BLOB and CLOB data types Informix Guide to SQL: Reference
SQL smart large object functions Informix Guide to SQL: Syntax
Informix ESQL/C smart large object features Informix ESQL/C Programmer's Manual
HCL Informix DataBlade API smart large object features Informix DataBlade API Programmer's Guide
Large Object Locator extension Informix Database Extensions User's Guide

Most of these publications are accessible through the InfoShelf.