company logo

Property :: provideGlobal - Provide instance outside the transaction

The function works the same way as the provide() function, except that global instances are created outside the transaction when not yet existing. When not running in a transactions the function works the same way as provide().

Creating global instances in a transaction prevents all other users from creating global instances for the same extent until the transaction is closed, since the index for the global collection is locked until terminating the transaction. Especially when creating instances via local collections that are based on global collections (extents), uncomfortable locks may block the system. In this case provideGlobal() should be used instead of provide().

Using provideGlobal() for creating a new instance, the instance will remain in the global collection also when rolling back the transaction.

When an error occurred or no instance could be selected (e.g. the new instance does not fulfill a filter condition), the function throws an exception.

Return value:  Property reference ( odaba::Property & )

A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

Implementation overview

Implementation details

  1. Provide instance by key value
    odaba::Property & Property  :: provideGlobal ( odaba::Key vSortKey )

    The function tries to provide an instance with the key value passed in vSortKey. The key value must correspond to the selected access key.When no instance exist with the key value passed, the function creates an instance by key value.

    For singular collections the function will replace the currently associated instance by the new instance with the passed key.

    • vSortKey - Access key

      The sort or access key value is provided as typed string in ESDF or CSV format. Key components can be separated by '|' or ';'.

      // key: name;first_name

      Miller;Paul          // simple positioned CSV key

      "Miller";"Paul Mary" // special characters must be quoted

  2. to list
  3. Provide instance at position
    odaba::Property & Property  :: provideGlobal ( int32 iPosition )

    The function tries to provide an instance at position passed in iPosition. The function does not check filter conditions. The value passed in iPosition must be a value greater or equal to 0. In case of an invalid position value or calling the function with a sorted collection property, the function throws an exception.

    When no instance exist at the position passed, the function creates a new instance.

    • iPosition - Position in collection

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

  4. to list
  5. Provide instance
    odaba::Property & Property  :: provideGlobal ( odaba::Property &cProperty )

    When passing the value for providing an instance in a collection via property handle, the function tries to provide the instance by key or index, depending on the data type defined in the property handle.

    When the property handle rPropertypasses a typed instance of the same or a specialized type as the instance to be selected, the key value is extracted from the instance passed in the property handle and provide by key is called. For singular collections the function will replace the currently associated instance by the new instance.

    When passing a text value, the text data is considered as string key and provide by key is called.

    When the property handle rProperty contains a numerical value, provide by position is called. Non integer numerical values are rounded to the next lower integer number.

    • cProperty - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

  6. to list