company logo

Property :: removeOrder - Remove transient order

The function removes a transient order created by calling orderBy() . Since transient indexes created by calling orderBy() are not maintained properly in case of errors while updating collections (insert, erase or rename instances), it is more appropriate to recreate a transient index (at least in case of update errors).

When the order is selected as current access key, the function will reset the order to the main key.

After removing a transient index, the index definition is not available anymore. In order to reactivate the sort order, orderBy() has to be called, again. Since transient attribute definitions are still available, those should not be redifined when reestablishing the index.

Implementation overview

Implementation details

  1. Remove all transient indexes
    Property  :: removeOrder (  )

    The function removes all transient indexes created for the collection.

  2. to list
  3. Remove transient index
    Property  :: removeOrder ( odaba::String &sKeyName )

    The function removes the transient index with the key name passed in sKeyName . When no such index is defined for the collection, the function throws an error.

    ... fragment ( Property  &person ) { // C++

      person.orderBy("DESC age,sex"); // order by transient key (descending age and sex)

      odaba::String  keyName(person.accessKeyDefinition().name());

      // ... do something

      person.removeOrder(keyName);

      // ... do something

      person.orderBy("DESC age,sex"); // reestablish order

    }

    • 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.

  4. to list