IdKey (Index Keyword)
Usage
To specify that the Object Identity values for this table should be formed from the property or properties on which this index is based, use the following syntax:
Index name On property_expression_list [ IdKey ];
Where:
-
name is the name of the index. It is useful to follow a naming convention so that indexes can be easily distinguished from properties. For example, you could include IDX at the end of all index names.
-
property_expression_list is either a single property name or a comma-separated list of properties, enclosed in parentheses.
Otherwise, omit this keyword or place the word Not immediately before the keyword.
Details
This keyword specifies that the property or properties on which this index is based will be used to form the Object Identity value for this object.
There must not be a sequential pair of vertical bars (||) within the values of any property used by an IDKEY index, unless that property is a valid reference to an instance of a persistent class. This restriction is imposed by the way in which the InterSystems SQL mechanism works. The use of || in IDKey properties can result in unpredictable behavior.
The Object Identity value is used to uniquely locate persistent object instances. Once an object using IdKey has been saved, you cannot modify the values of any of the properties that make up the IdKey.
An IdKey index also behaves like a unique index. That is, for the property (or the combination of properties) that you use in this index, InterSystems IRIS enforces uniqueness. It is permitted, but redundant, to specify the Unique keyword as true in this index definition.
For an IdKey index, InterSystems IRIS generates methods that you can use to open objects, check existence of objects, and delete objects; see Open, Exists, and Delete Methods.
Default
The default for the IdKey keyword is false.