Support functions provide the basic functionality that the database server needs to interact with your opaque data type. However, you might want to write additional UDRs to provide the following kinds of functions for your opaque data type:
An operator function is a user-defined function, such as plus() or equal(), that has a corresponding operator symbol. For an operator function to operate on the opaque data type, you must overload the routine for the opaque data type.
For general information about the operator functions that the database server provides, see Operators and Operator Functions. For general information on overloading routines, refer to Overloading Routines. For information on how to overload an operator function on an opaque data type, see Arithmetic and Text Operator Functions for Opaque Data Types.
A built-in function is a predefined function, such as cos() or length(), that the database server provides for use in an SQL expression. The database server supports built-in functions on the built-in data types. For an opaque data type, you must overload the function for the opaque type.
For general information about these built-in functions, see Built-In Functions. For information on how to overload a built-in function on an opaque data type, see Built-in Functions for Opaque Data Types.
An aggregate function returns one value, such as SUM or AVG, for a set of queried rows. You can extend the built-in aggregates to provide for your opaque data types. You can also create new, special-purpose aggregate functions.
For information about how to extend the built-in aggregates, refer to Extending Existing Aggregates. For information about how to create new aggregate functions, refer to Creating User-Defined Aggregates. For information about how to use aggregate functions, see the Expression segment in the IBM Informix: Guide to SQL Syntax.
The UPDATE STATISTICS statement calls the statcollect() function to collect statistics for the optimizer to use. The statcollect() function formats information so that the database server can display it.
For more information, refer to The statcollect() Function.
The database server allows you to define SQL-invoked functions or procedures that the end user can use in expressions or SQL statements. These end-user routines provide additional functionality that an end user might need to work with the opaque data type. Examples of end-user routines include:
Because the opaque data type is encapsulated, an end-user function is the only way that users can access fields of the internal structure.
Several of the support functions serve as cast functions between basic data types that the database server uses. You might also write additional cast functions between the opaque data type and other data types (built-in, opaque, or complex) of the database.
If an operation or task is performed often on the opaque data type, you might want to write an end-user routine to perform this task.
For more information about end-user routines, see Developing a User-Defined Routine.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]