14.01.2013 Views

IBM Informix Developer's Handbook - IBM Redbooks

IBM Informix Developer's Handbook - IBM Redbooks

IBM Informix Developer's Handbook - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A quick review of the data type hierarchy is useful. Figure 10-1 shows a summary<br />

of these data types.<br />

Figure 10-1 Hierarchy of data types in <strong>Informix</strong> servers<br />

The extended data types can be either UDR types or complex data types. We are<br />

especially interested in UDTs, which can be described as follows:<br />

► Distinct: Internally, this data type is stored the same as a source data type,<br />

but it is overlaid with different casts and functions defined beyond the basic<br />

source type. The server sees distinct types as different from the source type.<br />

It is necessary to tell the server:<br />

– Source data type information and how the internal structure is defined.<br />

– The functions of how this data type interacts with its internal structure.<br />

– The operations that are valid with this distinct data type.<br />

– Any secondary access methods on how to handle this type.<br />

– Cast functions to move data in and out of the distinct type are automatic.<br />

► Opaque: A fundamental, user-defined data type. It cannot be broken into<br />

smaller pieces, although it can serve as the building block for other data<br />

types. The internal structure of the opaque data type is invisible to the server.<br />

When you define and use an opaque type, the developer must provide all of<br />

the following:<br />

– How the internal structure is defined.<br />

– The functions that enable routines to interact with its internal structure.<br />

– The operations that are valid with this distinct data type.<br />

– Any secondary access methods on how to handle this type.<br />

– Cast functions to move data in and out of the distinct type need to be<br />

provided.<br />

Chapter 10. User-defined routines 335

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!