...
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiRemoteGetOpenMode(SdaiServerContext serverContextId,
SdaiInstance currInst,
SdaiAccessMode *openMode,
SdaiInvocationId *edmiInvocationId);
|
Returns the current open mode of a model or repository within a locally connected database. This feature has been implemented to provide all EDMInterface functionality through the remote EDMInterface calls. Only applicaple applicable for the LOCAL_CONTEXT communication type. Related functions: edmiRemoteGetOpenModeBN, edmiRemoteChangeOpenMode, edmiRemoteChangeOpenModeBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteGetOpenMode(SdaiServerContext serverContextId,
SdaiInstance currInst,
SdaiAccessMode *openMode,
SdaiInvocationId *edmiInvocationId);
Arguments:
Arguments
...
Type | Name | Comment |
SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
SdaiInstance | currInst | A modelId or repositoryId that uniquely identifies a model or a repository within the _EDMdatabase{_}the EDMdatabase . This is the repository or model for which to get the current open mode. |
SdaiAccessMode | openMode | A variable that will receive the current access mode to the model or repository. Possible access modes are sdaiRO, sdaiRW and sdaiNOACCESS. |
SdaiInvocationId | edmiInvocationId | Currently not used. |
...
Return Value
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
Options
...
Example
...
Code Block | ||
---|---|---|
| ||
EdmiError rstat; SdaiServerContext myLocalContext; SdaiModel modId; SdaiInteger index, nHits; SdaiInstance johnnysId; /* Define Remote Server Context */ rstat = edmiDefineServerContext("MyLocalContext", |
...
NULL, NULL, NULL, "LOCAL_CONTEXT", NULL, NULL, |
...
NULL, NULL, NULL, NULL, NULL, &myLocalContext); |
...
/* Get the modelId of MyModel */ |
...
rstat = edmiRemoteGetModelBN(myLocalContext, "DataRepository", |
...
"MyModel", &modId, NULL); |
...
/* Find Johnnys Id (Unique PID = 4572314) */ |
...
rstat = edmiRemoteFindInstancesBN(myLocalContext, modId, |
...
"Person", "PID = 4572314", sizeof(SdaiInstance), |
...
&index, &nHits, &johnnysId, NULL); |
...
/* If Johnny has a cellular |
...
phone, then confiscate it */ |
...
{ SdaiString _attrName = "CELLULAR"; |
...
SdaiBoolean *_isSet; |
...
SdaiAccessMode _openMode; |
...
rstat = edmiRemoteTestAttrsBN(myLocalContext, johnnysId, |
...
0, 1, &_attrName, &_isSet, NULL); |
...
if (*_isSet) { |
...
/* Get current open mode for MyMoodel */ |
...
rstat = edmiRemoteGetOpenMode(myLocalContext, |
...
modId, &_openMode, NULL); |
...
if (_openMode != sdaiRW) { |
...
/* Set write access to the model */ |
...
rstat = edmiRemoteChangeOpenMode(myLocalContext, |
...
modId, sdaiRW, NULL); |
...
} /* Confiscate the cellular */ rstat = edmiStartModelWriteTransaction(modId); |
...
rstat = edmiRemoteUnsetAttrsBN(myLocalContext, johnnysId, |
...
1, &_attrName, NULL); |
...
rstat = edmiCommitAllTransactions(); |
...
/* Reset the initial open mode on the model */ |
...
if (_openMode != sdaiRW) { |
...
rstat = edmiRemoteChangeOpenModeBN(myLocalContext, |
...
"MyRepository", "MyModel", _openMode, NULL); |
...
}
}
}
. . . |
See also
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|