company logo

ObjectSpace :: setAccessVersion - Set current access version

The function changes the access version for the object space when synchronized, object space, database or managed versioning mode has been enabled. In case of simple independent versioning modes (owner scope or instance versioning), the function throws an exception. In order to set a new access version, selections in all property handles opened for the object space will be reset after storing modification and reread with the new access version. Subordinated property handles become unselected, but requested version number will be changed. Requested version will be changed also for top collections (extents).

In case of hierarchical object spaces, access version for subordinated object spaces remains unchanged.

Setting the access version forces the system selecting database entries valid for the selected version number, i.e. database entries with the largest version number that is lower or equal to the selected access version. When the selected database entry version is not the most up to date (i.e. there exists at least one database entry with a higher version number), the database entry cannot be updated. In order to update database entries, the highest (current) version has to be selected.

Implementation overview

Implementation details

  1. Set version to current one
    ObjectSpace  :: setAccessVersion (  )

    In order to provide the topmost version for all database entries (which is the default after opening an object space, this function may be called.

      os.setAccessVersion(); // select current access version

  2. to list
  3. Set access version by major and minor version
    ObjectSpace  :: setAccessVersion ( int32 majorVersion, int32 minorVersion )

    When managed versioning had been set for the database, it is more comfortable setting version mode for major and minor version. In order to select the current version, -1 may be passed in majorVersion and minorVersion. In order to get the last minor version for a major version, -1 may be passed for minorVersion.

    The function throws an exception, when versioning mode is not managed.

      os.setAccessVersion(2,5);    // select major version 2 with minor version 5

      os.setAccessVersion(-1,-1);  // select current access version

      os.setAccessVersion(-1,5);   // select current major version with minor version 5

    • majorVersion - Major version number

      Major version numbers must have a value between 0 and 65534. In some cases -1 may be passed for requesting the current version or indicating an error.

    • minorVersion - Minor version number

      Minor version numbers must have a value between 0 and 65534. In some cases -1 may be passed for requesting the current version or indicating an error.

  4. to list
  5. Set access version to version number
    ObjectSpace  :: setAccessVersion ( uint32 uVersion )

    The function sets the scope access version for the object space to the version number passed in uVersion. The version number must be less than or equal to the last version number created for the database. For managed versioning modes, the major version number of uVersion must be a valid managed version. In this case, the function also changes the major version before setting the scope version.

    Requested version for collections (indexes) and instances in all opened property handles will be changed for property handles opened for the object space but nor for property handles opened in subordinated object spaces.

    When the version number is not valid or the versioning mode does not support the function, an exception will be thrown.

      os.setAccessVersion(3);  // select access version 3

      os.setAccessVersion(-1); // select current access version

    Notes:

    In case of not synchronized instance or owner scope versions, top collections (extents) do not create versions (version number is 0 and cannot be changed).

    • uVersion - Instance version number

      Instance version numbers are assigned version numbers to individual instances.

  6. to list