company logo

IndexDefinition :: hasKey - Does index provide a key definition

The property returns, whether the index provides a key definition or not. Since requesting the key definition from an index definition will throw an exception, when the index does not have got a key definition, the function can be called before requesting a key definition in order to avoid unnecessary exceptions.

... fragment ( property &person ) {

  IndexDefinition id(person.propertyDefinition().indexDefinition(0));

  if ( id.hasKey() )

    Application::output(id.keyDefinition().name);

  else

    Application::output("person collection is not ordered");

}

Return value:  Success ( bool  )

The value is true when the function was executed successfully. Otherwise the value is set to false.

Implementation details

bool IndexDefinition  :: hasKey (  )