company logo

Property :: duplicate - Duplicate instance

The function can be used in order to create a copy of the positioned instance in the same collection.

Duplicate should be used only, when the instance to be copied has no shared base instances or if all shared base instances are identified by the selected access key for the collection. When this is not the case, the system tries to create appropriate base instances referring to the original base instance except base instances identified by __AUTOIDENT or __IDENTITY, i.e. duplicate() will not copy automatic keys but creates new base instances with new keys.

When the property handle is not valid, when no instance is selected in the property handle or when an other error has been encountered, 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 details

odaba::Property & Property  :: duplicate ( odaba::Key vNewKey, odaba::ReplaceOptions eReplace )

The function duplicates the instance replacing the sort key value passed in vNewKey. Depending on the replace option passed in eReplaceOptions, an existing instance might be overwritten by the instance to be duplicated.

  • vNewKey - New key value for instance

    The key passed for renaming the instance must be structured according to the currently selected sort order. Key components within a key must be separated by '|' or ';'. An empty string can be passed in order to indicate no key value.

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

  • eReplace - Replace option

    Replace options can be passed in order to control the behavior of copy functions.