Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > CREATE OPAQUE TYPE >

Defining an Opaque Type

To define a new opaque data type to the database server, you must provide the following information in the C or Java language:

The following table summarizes the support functions for an opaque data type.

Function Description Invoked
input( ) Converts the opaque type from its external LVARCHAR representation to its internal representation When a client application sends a character representation of the opaque type in an INSERT, UPDATE, or LOAD statement
output( ) Converts the opaque type from its internal representation to its external LVARCHAR representation When the database server sends a character representation of the opaque type as a result of a SELECT or FETCH statement
receive( ) Converts the opaque type from its internal representation on the client computer to its internal representation on the server computer Provides platform-independent results regardless of differences between client and server computer types When a client application sends an internal representation of the opaque type in an INSERT, UPDATE, or LOAD statement
send( ) Converts the opaque type from its internal representation on the server computer to its internal representation on the client computer Provides platform-independent results regardless of differences between client and database server computer types When the database server sends an internal representation of the opaque type as a result of a SELECT or FETCH statement
db_receive( ) Converts the opaque type from its internal representation on the local database to the dbsendrecv type for transfer to an external database on the local server When a local database receives a dbsendrecv type from an external database on the local database server
db_send( ) Converts the opaque type from its internal representation on the local database to the dbsendrecv type for transfer to an external database on the local server When a local database sends a dbsendrecv type to an external database on the local database server
server_receive( ) Converts the opaque type from its internal representation on the local server computer to the srvsendrecv type for transfer to a remote database server Use any name for this function. When the local database server receives a srvsendrecv type from a remote database server
server_send( ) Converts the opaque type from its internal representation on the local server computer to the srvsendrecv type for transfer to a remote database server Use any name for this function. When the local database server sends a srvsendrecv type to a remote database server
import( ) Performs any tasks needed to convert from the external (character) representation of an opaque type to the internal format for a bulk copy When DB–Access (LOAD) or the High Performance Loader (HPL) initiates a bulk copy from a text file to a database
export ( ) Performs any tasks needed to convert from the internal representation of an opaque type to the external (character) format for a bulk copy When DB–Access (UNLOAD) or the High Performance Loader initiates a bulk copy from a database to a text file
importbinary( ) Performs any tasks needed to convert from the internal representation of an opaque type on the client computer to the internal representation on the server computer for a bulk copy When DB–Access (LOAD) or the High Performance Loader initiates a bulk copy from a binary file to a database
exportbinary( ) Performs any tasks needed to convert from the internal representation of an opaque type on the server computer to the internal representation on the client computer for a bulk copy When DB–Access (UNLOAD) or the High Performance Loader initiates a bulk copy from a database to a binary file
assign( ) Performs any processing required before storing the opaque type to disk This support function must be named assign( ). When the database server executes INSERT, UPDATE, or LOAD, before it stores the opaque type to disk
destroy( ) Performs any processing necessary before removing a row that contains the opaque type This support function must be named destroy( ). When the database server executes the DELETE or DROP TABLE, before it removes the opaque type from disk
lohandles( ) Returns a list of the LO-pointer structures (pointers to smart large objects) in an opaque type When the database server must search opaque types for references to smart large objects; when oncheck runs, or an archive is performed
compare( ) Compares two values of the opaque type and returns an integer value to indicate whether the first value is less than, equal to, or greater than the second value When the database server encounters an ORDER BY, UNIQUE, DISTINCT, or UNION clause in a SELECT statement, or when CREATE INDEX creates a B-tree index

After you write the necessary support functions for the opaque type, use the CREATE FUNCTION statement to register these support functions in the same database as the opaque type. Certain support functions convert other data types to or from the new opaque type. After you create and register these support functions, use the CREATE CAST statement to associate each function with a particular cast. The cast must be registered in the same database as the support function.

After you have written the necessary C language or Java language source code to define an opaque data type, you then use the CREATE OPAQUE TYPE statement to register the opaque data type in the database.

Related Information

Related statements: CREATE CAST, CREATE DISTINCT TYPE, CREATE FUNCTION, CREATE ROW TYPE , CREATE TABLE , and DROP TYPE

For a description of an opaque type, see the IBM Informix Guide to SQL: Reference.

For information on how to define an opaque type, see IBM Informix User-Defined Routines and Data Types Developer's Guide.

For information on how to use the Java language to define an opaque type, see the J/Foundation Developer's Guide.

For information about the GLS aspects of the CREATE OPAQUE TYPE statement, refer to the IBM Informix GLS User's Guide.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]