company logo

ObjectSpace :: setMajorVersion - Set current major version

The function may be called in order to set the access version for the object space. Although major versions are defined on database level, different object spaces opened for a database may access the database for different major versions simultaneously. When opening an object space (or database), the major version valid for the current time point is activated. In order to access data for older major versions, required major version may be activated via version number or time stamp or implicitly via scope version number. Major versions with starting time in future (newer than "now") cannot be activated.

In contrast to setAccessVersion() for combined versioning modes the function sets the minor version to the maximum minor version number, i.e. to 0xFFFF for older major versions and to the last scope version for the current major version.

The function may be called for any kind of managed versioning mode. When being called for not managed versioning modes(versioningMode()), the function throws an exception. In this case, one may call setAccessVersion(). Setting access version for managed... or managedSyncronized... versioning modes, the current scope access version is set to the highest version number for the selected major version, which is the last version number for the current major version and minor version 0xFFFF for any older version.

Activating another major version is possible while property handles are opened. Since the function may influence data selected in property handles, all property handles are stored and unselected before changing version (Property::top()).

Notes:

When accessing older major versions, instances and collections, which have already been updated in newer major versions, are set to read-only and cannot be updated in previous major version. Collections and instances, which have not been updated in newer major versions, can be modified.

Return value:  Major version number ( int32  )

Major versions are defined on database level. database versions are numbered consecutively beginning with 0, when consistent versioning has been enabled.

Implementation overview

Implementation details

  1. Reset version to current version
    int32 ObjectSpace  :: setMajorVersion (  )

    The function sets the major version corresponding to "now", i.e. to the one with the time interval including the current time point.

  2. to list
  3. Set version according to version number
    int32 ObjectSpace  :: setMajorVersion ( int32 iVersion )

    The major version to be accessed is set to the number passed in iVersion. For consistent versioning the version number must be less or equal to the major version number corresponding to "now", i.e. one cannot activate future major versions when consistent version mode is activated. For synchronized version mode, any major version defined for the database can be selected.

    • iVersion - Major version number

      Major versions are defined on database level. database versions are numbered consecutively beginning with 0, when consistent versioning has been enabled.

  4. to list
  5. Set version according to timestamp
    int32 ObjectSpace  :: setMajorVersion ( odaba::DateTime &cDateTime )

    The major version is set to the version corresponding to the time point passed in cDateTime, i.e. to the version, which has a staring time point lower or equal to cDateTime and a termination time greater that the cDateTime value. The value passed in cDateTime must not be a time point in future for consistent versioning.

    • cDateTime - Time stamp

      A time stamp combines date and time

  6. to list