Tutorial exercise 4: Creating opaque data types

This exercise demonstrates how to create opaque data types, their support routines, and user-defined routines that operate on them. This exercise has 11 steps. It takes approximately one hour to complete.

About this task

The example Circle DataBlade® module in this exercise is similar to the RowCircle DataBlade® module in the Creating Row Data Types exercise. The difference is that the Circle DataBlade® module creates opaque data types, whereas the RowCircle DataBlade® module creates row data types.

The Circle DataBlade® module creates two new data types, Pnt and Circ, and two new functions, Distance() and Contains(). Similar to the RowCircle DataBlade® module, the Circle DataBlade® module enables you to:
  • Store circles or points in a single column of a database table.
  • Calculate the distance between two points.
  • Calculate whether a circle contains a point.
The following diagram illustrates the type of data Circle data types contain.
Figure 1. Type of data that Circle data types contain
begin figure description - This figure is described in the surrounding text. - end figure description

The Circle DataBlade® module that you create in this exercise is similar to the example Circle DataBlade® module included with the DataBlade® Developers Kit. You can look at the example DataBlade® module to see how to change the input format of an opaque circle type and how to add functionality. The example Circle DataBlade® module is located in the %INFORMIXDIR%\dbdk\examples\types\dapi\Circle directory, where %INFORMIXDIR% is the environment variable that represents the root directory of your DBDK installation.