...
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiRollbackModelBN(SdaiString repositoryName,
SdaiString modelName,
SdaiString modelVersionName,
SdaiOptions options);
|
Rolls back the current version of an edmModel to a previous version. The model version is identified by the names of the edmRepository, the edmModel and the version.
By default, all versions succeeding the new current version will be permanently deleted. Use options to prevent deletion of versions. Related functions: edmiCreateModelVersion, edmiDeleteModelVersion, edmiDeleteModelVersionBN, edmiGetModelVersionId, edmiGetModelVersionIdBN, edmiRollbackModel, edmiRollbackModelBN, edmiVersionGetAttr, edmiVersionGetAttrBN, edmiVersionGetAttrDatatype, edmiVersionGetAttrDatatypeBN.
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRollbackModelBN(SdaiString repositoryName,
SdaiString modelName,
SdaiString modelVersionName,
SdaiOptions options);
Arguments:
Arguments
...
Type | Name | Comment | |
SdaiString | repositoryName | The name of the edmRepository in the EDMdatabase holding the edmModel to be rolled back. Repository names are case sensitive. | |
SdaiString | modelName | The name of the edmModel to roll back. Model names are case sensitive. The combination of the arguments <repositoryName> and <modelName> uniquely identifies an edmModel in the EDMdatabase. | |
SdaiString | modelVersionName | The name of the model version to roll back to. | |
SdaiOptions | options | Specifies the options to be used in the invocation of the edmiRollbackModelBN function. The <options> value is a bitwise OR between the available options listed below. | If no option value is given, all model versions succeeding <versionId> will be permanently deleted from the edmModel. |
...
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Options
...
Option | Comment |
---|---|
KEEP_ALL_MODEL_VERSIONS | No versions of the edmModel will be deleted when rolling back. |
...
Example
...
Code Block | ||
---|---|---|
| ||
EdmiError rstat; SdaiInteger nWrn, nErr; SdaiRepository repId; SdaiModel modelId; SdaiVersion version1Id, version2Id; SdaiModelVersion modelVersionId; SdaiInteger myInteger; SdaiReal myReal; SdaiInstance instId; SdaiAttr attrId; SdaiPrimitiveType type; /* Compile schema */ rstat = edmiCompileFile("c:/data/MyFile.exp", |
...
"c:/tmp/MyFile.dia", |
...
"MySchema", 0, &nWrn, &nErr); |
...
/* Create Model */ |
...
rstat = edmiGetRepository("MyRepository", &repId); |
...
modelId = edmiCreateModelBN(repId, "MyModel", "MySchema", 0); |
...
/* Populate Model */ |
...
instId = edmiCreateInstanceAndPutAttrsBN(modelId, "MyEntity", 1, |
...
"REAL_ATTR", sdaiREAL, 3.14); |
...
/* Create version 1 */ |
...
rstat = edmiCreateModelVersion("MyRepository", "MyModel", |
...
"V1", &modelVersionId); |
...
/* Change population */ |
...
sdaiPutAttrBN(instId, "REAL_ATTR", sdaiINTEGER, 1); |
...
/* Create version 2 */ |
...
rstat = edmiCreateModelVersion("MyRepository", "MyModel", |
...
NULL, &modelVersionId); |
...
/* Get Id of version 1 */ |
...
rstat = edmiGetModelVersionIdBN("MyRepository", "MyModel", |
...
"V1", &modelVersionId, &version1Id); |
...
/* Type is sdaiREAL */ |
...
rstat = edmiVersionGetAttrDatatypeBN(instId, version1Id, |
...
"REAL_ATTR", &type); |
...
/* Value is 3.14 */ |
...
if (type != sdaiREAL) goto error; |
...
rstat = edmiVersionGetAttrBN(instId, version1Id, "REAL_ATTR", |
...
type, &myReal); |
...
/* Get Id of version 2 */ |
...
attrId = sdaiGetAttrDefinitionBN("MySchema", "MyEntity", "REAL_ATTR"); |
...
rstat = edmiGetModelVersionId(modelId, "version2", |
...
&modelVersionId, &version2Id); |
...
/* Type is now sdaiINTEGER */ |
...
rstat = edmiVersionGetAttrDatatype(instId, version2Id, |
...
attrId, &type); |
...
/* Value is 1 */ |
...
if (type != sdaiINTEGER) goto error; |
...
rstat = edmiVersionGetAttr(instId, version2Id, attrId, |
...
type, &myInteger); |
...
/* Roll back to version 1 */ |
...
rstat = edmiRollbackModelBN("MyRepository", "MyModel", "V1", |
...
KEEP_ALL_MODEL_VERSIONS); |
...
/* Delete version 2 */ |
...
edmiDeleteModelVersion(modelId, version2Id); |
...
error: |
...
. . . |
See also
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|