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 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:
serverContextId |
Context identification, from edmiDefineServerContext |
currInst |
A modelId or repositoryId that uniquely identifies a model or a repository within the _EDMdatabase{_}. This is the repository or model for which to get the current open mode. |
openMode |
A variable that will receive the current access mode to the model or repository. Possible access modes are sdaiRO, sdaiRW and sdaiNOACCESS. |
edmiInvocationId |
Currently not used. |
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
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);
}
}
}
. . .