company logo

Property :: parent - Get parent property

The function returns a parent property handle. The parent property handle is the next higher property handle in the property hierarchy, which might differ from the type hierarchy. Usually, one will get the property handle as parent, which has been used for opening or constructing the current property handle.

For references and relationships, this is the next higher collection property handle, i.e. the next higher reference, relationship or shared base structure property. For attributes, it depends on the way the attribute node has been opened and might be another attribute property, but also the next higher reference or relationship property. In order to get the property handle owning the database instance with the attribute, one may call collectionProperty().

The handle returned refers to an internally opened cursor, which might be shared with other handles in the application. In order to get a private copy of the parent property handle, one may call cursorCopy().

When the property is not valid or when the requested parent property does not exist, the function returns an invalid property handle..


... fragment( Property  &ph ) {

  Property   parent;

  parent = ph.parentProperty(); // use system shared cursor

  if ( parent.isValid() )

    parent.cursorCopy(ph.parentProperty()); // create cursor copy

  return parent;

}

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. Get parent property handle
    odaba::Property Property  :: parent (  )

    The function returns the next higher property handle. In case of top property handles that do not have a parent, the function returns an invalid property handle.

  2. to list
  3. Get parent by type
    odaba::Property Property  :: parent ( odaba::String &sTypeName )

    The function looks for the parent property in the parent hierarchy with the type passed in sTypeName. In case of weak typed collection, the base type of the collection is checked. When no appropriate parent could be located, the function returns an empty (invalid) property handle (Property::isValid()).

    • sTypeName - Type name

      The type name is the name of a data type (usually) defined in the database. The type name might be passed as simple identifier or as scoped name with preceding namespace names separated by double colon '::'.

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

  4. to list