company logo

Database :: resetVersion - Reset owner scope version

Resetting a scope version is supported for synchronized and database versioning modes (also in combination with managed). The function must not be called for versioning modes, which do not support the synchronized feature, except when resetting all versions (to version number 0). In case of managed versioning modes, the function may also be called for resetting a major version. In order to reset versioning completely, version number 0 may be passed. In this case, all newer versions and the versioning mode are reset.

The function will also reset "empty" versions, i.e. versions at the end which do not contain database entries. Thus, the (major) version number resulting from the function call may be less than uVersion-1.

The function removes all database entries with newer version numbers, i.e. version numbers greater or equal to uVersion, and recreates the state of the database entry for the previous version number (uVersion-1). The version number passed in uVersion has to be greater than 0 and lower than or equal to the last version number (lastVersion()). Passing 0xFFFFFFFF will reset the last database version. The function also resets the scope version number of the database to the last version number used.

When resetting scope versions for databases with supporting managed versioning feature, the major version of the version number passed has to be the last major version created for the database. In order to reset to older versions one may call resetMajorVersion().

After resetting a version one should close and reopen the database.

When an invalid version number has been passed in uVersion or when the versioning mode does not support synchronized minor versions (synchronized or database), the function throws an exception.

Notes:

When resetting versions completely (version number 0), this may cause index inconsistency in case of instance or ownership

Implementation details

Database  :: resetVersion ( uint32 uVersion )
  • uVersion - Instance version number

    Instance version numbers are assigned version numbers to individual instances.