INFORMIX
DataBlade Developers Kit User's Guide
Chapter 2: Designing DataBlade Modules
Home Contents Index Master Index New Book

Data Type Design

After you have designed a data model for your DataBlade module, you can design its specifics, such as data types to best represent your DataBlade module objects.

Informix Dynamic Server supports a rich set of data types, known as built-in data types. (For information on the built-in types, see the Informix Guide to SQL: Reference.) Informix recommends that you use built-in types wherever possible; however, even with built-in types, consider the following design issues:

This section provides some guidelines for making these design decisions.

Object Accessibility

The main categories of data types are row data types and opaque data types. To decide which category to use, consider how accessible the elements of each DataBlade module object should be:

For example, say the users of the SimpleMap DataBlade module want to see and operate directly on the street number and street name, country, and postal code. You might decide to provide the Address data type.

If you create Address as an opaque type, each member of the underlying C structure can store a different element of the address. However, this means you must also define accessor routines for each element.

However, if you create Address as a row type, Informix Dynamic Server automatically provides direct access to each of the fields, as follows:

This allows users to write queries like the following example:

In contrast, because users seldom need to examine the individual points of a polygon, you can create the Polygon type as an opaque data type. An opaque data type provides an efficient representation that you can operate on easily with C code. The query language interface remains simple.

When you design data types, ask yourself the following questions:

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.)

Informix Dynamic Server provides the LVARCHAR data type, which can hold up to 2 KB of text data. Larger objects and binary objects are called smart large objects, and Informix Dynamic 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 Informix Dynamic Server.

Tip: If your DataBlade module makes use of smart large objects, you can test for the existence of a particular sbspace when your DataBlade module is being registered in a database using BladeManager. For information, see Appendix C, "Testing for an Sbspace."
Smart large objects are "smart" because they provide the following features:

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

You can also use the Informix LOB Locator DataBlade module to handle large objects. This DataBlade module enables you to store large object data on the client machine. The LOB Locator DataBlade module is included with Informix Dynamic Server with Universal Data Option. You must register the module's routines and data types in each database in which you plan to use the module.

When you design data types, ask yourself the following questions:

The following table lists large object topics and where you can find more information on them.
For information on... See...

Using smart large objects, including examples

http://www.informix.com/idn

Overview of smart large objects

Informix Guide to SQL: Tutorial

Creating sbspaces

Administrator's Guide for Informix Dynamic Server

Testing for the existence of a particular sbspace during DataBlade module registration

Appendix C, "Testing 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

Informix DataBlade API smart large object features

DataBlade API Programmer's Manual

Informix LOB Locator DataBlade module

LOB Locator DataBlade Module Programmer's Guide

Most of these manuals are accessible through the InfoShelf.




DataBlade Developers Kit User's Guide, version 3.6
Copyright © 1998, Informix Software, Inc. All rights reserved.