company logo

PropertyDefinition :: indexDefinition - Get index definition

The function returns the index definition for a collection property.

When the function is called with an invalid property definition or when the property does not provide an index definition, the function throws an exception.

... fragment ( Property &person ) {

  PropertyDefinition   pd(person.propertyDefinition());

  int                  count = pd.indexCount();

  while ( count-- )

    Application::output(indexDefinition(count).name());

}

Return value:  Index definition ( odaba::IndexDefinition  )

An index definition defines a sort order for a collection.

Implementation overview

Implementation details

  1. Get index definition by name
    odaba::IndexDefinition PropertyDefinition  :: indexDefinition ( odaba::String &sKeyName )

    The function returns the index definition with the key name passed in sKeyName . When no index with the passed key name could be located, the function throws an exception.

    • sKeyName - Key name

      The key name must be the name of a key defined for the given structure. The key name is passed as string with maximum 40 characters.

      In order to pass no key name, an empty string ( String() ) has to be passed.

  2. to list
  3. Get index definition at position
    odaba::IndexDefinition PropertyDefinition  :: indexDefinition ( int32 iPosition )

    The function returns the index definition at position passed in iPosition . When no index is available at requested position, the function throws an exception.

    • iPosition - Position in collection

      The position of an element in a collection is beginning with 0 for the first element.

  4. to list