Loading...
 

AddIndex

AddIndex

Attention!
Outdated! Indexmanager provides functions for index management

AddIndex(CX_xxxxx), AddIndex(CX_xxxxx, k)

parameters: Identifier of a class, number of a domain (default is k = 0)

Stack
Stack Position Description
Stack(In) Top ]
Top 1 Parameters
. . .
Top-n [
Stack(Out) -

A RootEP-Collection of the class specified as parameter receives an index. Parameter k selects the collection: Within the current layer (see SetLayer) it is the k-th of the class specified in the first parameter. Settings set with SetDomain have no effect here(Note ...).

The following parameters are expected on the stack:

Type Meaning
Character string the index path must be specified
integer Options optional, standard acceptance = ORDERED + COPY_KEY
OBJECTS_PER_TXN n requires index building in several transactions, n objects are processed per transaction optional, only useful to avoid address space overflow

Options are described by the constants ORDERED, NO_DUPLICATES, POINT_TO_KEY, COPY_KEY (combine several constants with + or | ) An index can be removed with DropIndex.
AddIndex creates an entry in the index manager (an object CX_INDEX_DESCRIPTOR).

Collections also exist as an element of an object. An index for such a collection is specified with

AddIndex(CX_xxxxxx, access expression)

with the following parameters:

Type Meaning
Object Object from which the collection is accessed must be specified
Character string the index path must be specified
integer Options optional, standard acceptance = ORDERED + COPY_KEY
OBJECTS_PER_TXN n requires index building in several transactions, n objects are processed per transaction optional, only useful to avoid address space overflow

As index path an expression can be formed which

  1. corresponds to the possibilities provided by ObjectStore, i.e. fixed data fields and ...
  2. calls up query functions known in the database schema.
  3. refers to dynamic data fields. Dynamic data fields with which an index is to be built up must first be registered in CLASSIX.INI with the statement Index.
  4. With the pseudo function Retrieve, one or more InstantView® access expressions can be passed as parameters.
  5. The POINTER data type cannot be indexed, neither as a fixed data field nor as a slot.

For 1. and 3. the index is automatically updated if the value of an object attribute changes, on which the position of this object within the index depends. For the "fixed" data fields, the DDI specifies whether an index can be created for this field. This restriction serves to improve performance: the overhead for index updating is avoided for data fields for which an index is never built.
In addition, you can specify for a data field in the DDI which query functions depend on its value. Indexes with these query functions are then automatically updated (case 2.)
For an index after 3. there is no automatic update! Here the update of the index (possibly also of several indices  (!) can be triggered explicitly (see Retrieve).

For indices via an integer or enum slot there is a special feature: If the slot is not available, a value of 0 is assumed. The 0 can therefore either represent the value "0" or it means: slot not available.

- Examples -