company logo

Property :: accessVersion - Instance access version

The instance access version defines the version number for accessing instances for the property handle. The access version does not affect the collection managed by the property handle. The property contains a meaningful value only for collection properties with a selected instance (references, generic attributes, relationships, extents) and cannot be accessed for other property handles (attributes, base types).

The property returns the instance access version for the property handle. This is either an access version explicitly set for the property handle or the access version set for the object space. In order to read older data entry version, accessVersion(uVersion) may be called to set the requested version as access version.

When the database does not support versioning, the function returns the maximum version value (0xFFFFFFFF). When no instance is selected or when the property handle is invalid, the function throws an exception.

Return value:  Instance version number ( uint32  )

Instance version numbers are assigned version numbers to individual instances.

Implementation details

uint32 Property  :: accessVersion (  )

The function returns the instance access version requested for property handle. This is usually not the data version for the currently selected instance, which might be older. When no specific version has been requested by setting an access version calling setAccessVersion(uVersion), the property returns the object space access version (ObjectSpace::accessVersion()). When no versioning mode has been activated, the access version is 0.

In order to get the data version for the selected instance, version() might be called.

When the property handle is not valid, the function throws an exception.


... fragment ( Property &person ) { // read all data versions for an instance

  int      inst_version;

  if ( person.selected() )

    while ( true ) {

      inst_version = version();

      printf("Name at version %i is &s",

                inst_version,person.value("name").toString());

      if ( inst_version > 0 )

        setAccessVersion(inst_version-1);

      else

        break;

    }

  }

}

Notes:

For attributes, the function returns the version for the parent instance.