Unsets one ore more attributes, identified by their attributeIds, of a specified instance, identified by its instanceId. The attributeIds are specified in the input buffer argument <attributeIds>. This operation is only applicable on the explicit attributes of application instances.
Related function: edmiRemoteUnsetAttrsBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteUnsetAttrs(SdaiServerContext serverContextId,
SdaiInstance instanceId,
SdaiInteger attributes,
SdaiAttr attributeIds[],
SdaiInvocationId *edmiInvocationId);
Arguments:
serverContextId |
Context identification, from edmiDefineServerContext |
instanceId |
A numeric instanceID that uniquely identifies the instance of interrest in the remote _EDMdatabase{_}. |
attributes |
The number of attribute names in the <attributeIds> argument. |
attributeIds[] |
A buffer containing the attributeIds of all the attributes to be unset. |
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 myContext;
SdaiInteger index, nHits;
SdaiQueryResult qexRes;
char condition[1024], *pCond;
SdaiOptions options;
/* Create Server Context */
rstat = edmiDefineServerContext("MyContext",
"Johnny", "Supervisor", "cf37ftr",
"TCP", "9090", "MyServerHost",
NULL, NULL, NULL, NULL, NULL, &myContext);
/* Get Johnnys instance Id */
nHits = 2;
index = 0;
options = ONLY_INSTANCE_IDS | SUBTYPES;
pCond = &condition[0];
pCond += sprintf(pCond, "(LAST_NAME = 'Jackson')");
pCond += sprintf(pCond, " AND (FIRST_NAME = 'Johnny')");
pCond += sprintf(pCond, " AND (BIRTH_DATE = '19631216)')");
rstat = edmiRemoteSelectInstances(myContext, "DataRepository",
"SocialRelations", "Person", condition, options,
NULL, NULL, NULL, &index, &nHits, &qexRes,
NULL, NULL, NULL, NULL);
if (nHits != 1) {
printf("\n%s", nHits ? "Ambigious" : "Not found");
} else {
SdaiInstance _johnnysId = qexRes->instanceIds[0];
SdaiAttr _attrIds[2];
SdaiEntity _manEID;
SdaiModel _modelId;
/* Johnny was recently divorced.
His wife left him in his car. */
/* Get the model Id */
rstat = edmiRemoteGetModelBN(myContext, "DataRepository",
"SocialRelations", &_modelId, NULL);
/* Get Man entity Id */
rstat = edmiRemoteGetEntity(myContext, _modelId,
"Man", &_manEID, NULL);
/* Get Man.Wife attribute Id */
rstat = edmiRemoteGetAttrDefinitionBN(myContext,
"SocialRelations", "Man", "Wife",
&_attrIds[0], NULL);
/* Get Man.Car attribute Id */
rstat = edmiRemoteGetAttrDefinitionBN(myContext,
"SocialRelations", "Man", "Car",
&_attrIds[1], NULL);
/* Unset Johnnys Wife and Car attributes */
rstat = edmiRemoteUnsetAttrs(myContext,
_johnnysId, 2, _attrIds, NULL);
}
edmiFreeQueryResult(qexRes);
. . .