Domains and User Defined Types (UDT)

Top Previous Next

A domain is a storage for some column attributes. Using domains you can create a column with all the required properties already defined (e.g. data type, length, precision, etc.), and modify a number of columns at once.

To create a domain and set all the domain properties use the Domain & User Defined Type Manager. This tool allows you to add, modify, and remove domains and UDT's.

After you have created diagram domains, it becomes much easier to add columns to the diagram tables - you can simply select the appropriate domain for the column within the Column Editor, and this assigns all domain attributes to the corresponding column attributes. It is also much more convenient to modify the domain-based columns than usual columns. Modifying any of the domain attribute updates all the columns, based on this domain.

The composite type is specified by a list of attribute names and data types. This is essentially the same as the row type of a table, but using UDT Manager avoids the need to create an actual table when all that is wanted is to define a type. A stand-alone composite type is useful as the argument or return type of a function.

The Domain & User Defined Type Manager allows creation of a new base type (scalar type). You must register two or more functions (using Stored Procedure Editor) after defining the type. A user-defined type must always have input and output functions. These functions determine how the type appears in strings (for input by the user and output to the user) and how the type is organized in memory. The input function takes a null-terminated character string as its argument and returns the internal (in memory) representation of the type. The output function takes the internal representation of the type as argument and returns a null-terminated character string. If we want to do anything more with the type than merely store it, we must provide additional functions to implement whatever operations we'd like to have for the type.

See also:
Diagram Objects: Column Editor | Domain & User Defined Type Manager | Stored Routine Editor