INFORMIX DataBlade Developers Kit Tutorial

List of Exercises

Tutorial Exercise 5

Creating Opaque Data Types

This exercise demonstrates creating opaque data types, their support routines, and user-defined routines that operate on them.

The Circle DataBlade module in this exercise is very similar to the RowCircle DataBlade module in Exercise 4. 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(). Just like 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.

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 additional functionality. The example Circle DataBlade module is located in the %INFORMIXDIR%\dbdk\examples\types\dapi\Circle directory.

Tutorial Steps

This exercise has 13 steps. It takes approximately one hour to complete.


1

Create the new project.

Start BladeSmith from the Informix program group and choose Project New.

Enter the following information into the New Project wizard.

Project Property Value

DataBlade module name

Circle

Object prefix

Leave blank

Description locale

en_us.1252

Server compatibilty

Your database server version

Project version number (Major.Minor)

1.0

Project description

This DataBlade module supports the Pnt and Circ opaque types.

Vendor unique ID (optional)

Your company's name

Company information

Your company's name, copyright, and contact information

Click Finish.

Choose Project Save; create a new directory called Circle in any convenient place on your hard drive and save your project in this directory as a file called Circle.ibs.


Copyright © 1998, Informix Software, Inc. All rights reserved.