Key definition dialog
For key definitions, just a simple key dialog has been provided instead of a wizard. The key dialog always pops up, when creating a new key or when defining a key created in the data type wizard. After entering the key name in the wizard or in the insert dialog for the key list, the key dialog pops up.
Three kinds of keys are supported:
- Component keys - consist of one or more attributes (key components) defined in the complex data type or one of its base types.
- Auto-Identifier key - is a component key, that contains an __AUTOIDENT attribute as key component
- Identity key - Is a key without components referring to the object identity.
After selecting the proper key type, one may add required key components.
When defining a component key, one may select a key component from the attributes listed in the drop list, or enter a component path in the Component field.
Clicking the Append button will add the attribute to the key component list. When defining a key component that does not yet exist as attribute, an attribute with the key component name will be created for the selected data type. By default, the data type for the new attribute is CHAR , which might be changed later editing the attribute in the attribute list.
One may also refer to attributes in complex attributes by defining an attribute path as address.street . In this case, the path must be a valid attribute path.
In order to make the key case insensitive, the check box in the IC (ignore case) column might be activated. The descending column ( DSC ) allows defining descending order for single key components when referring to the key as order key (default is ascending). When comparing key values with descending order, the compare result is inverted, i.e. comparing with a greater key value returns greater and comparing with a lower key value returns lower.
In order to use the selected key definitions, OK may be pressed, or Cancel for rolling back the changes.
In order to maintain automatic numbers, an index referring to an auto-identifier key has to be defined for the owning collection of instances (e.g. the extent). Auto-numbers are sort of self initializing keys, i.e. each instance added to a auto-numbered collection automatically gets the next higher number in the __AUTOIDENT attribute.
When selecting the Auto-ident Key type , the key component __AUTOIDENT is shown automatically in the Component field and has to be added to the component list by clicking Append . When __AUTOIDENT does not yet exist as attribute, it will be added to the attribute list with data type INT (10) .
One may add further key components, but this usually does not make sense, since auto-ident keys are unique by definition.
For using the selected key definitions, OK may be pressed, or Cancel for rolling back changes.
Identity keys do not refer to any attribute but to object identity, instead. Thus, identity keys to not get any key component. Usually, identity orders define an order by birth, since newer object instances get higher identity numbers than older ones.
Identity keys require a specific name __IDENTITY. Thus, when defining e new key as identity key, it is automatically renamed. After selecting Key type identity key, one may only Cancel the key dialog or confirm with OK .