edmiRemoteCreateInstanceAndPutAttrsEx
EdmiError edmiRemoteCreateInstanceAndPutAttrsEx(SdaiServerContext serverContextId, SdaiModel remoteModelId, SdaiEntity entityId, SdaiInteger attributes, SdaiAttr attributeIds[], SdaiSelect attributeValues[], SdaiOptions options, SdaiAppInstance *newInstanceId, SdaiInvocationId *edmiInvocationId);
This operation creates an entity instance and optionally set the specified attribute values of the created instance in a remote model. This function implements the same functionality as edmiRemoteCreateInstanceAndPutAttrs, but uses buffers in stead of a variable argument list to transfere attribute values.
This operation is only applicable to data models.
Arguments
1 | Type | Name | Comment |
2 | SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
3 | SdaiModel | remoteModelId | The numeric modelID that uniquely identifies the edmModel in the remote EDMdatabase in which the instance is to be created. |
4 | SdaiEntity | entityId | The numeric entityID that uniquely identifies the entity definition instance in the dictionary model within the remote EDMdatabase.The entityID is returned by the edmiRemoteGetEntity function. |
5 | SdaiInteger | attributes | The number of attribute values given in the variable argument list <values>. |
6 | SdaiAttr | attributeIds | A buffer containing the attributeIds of all the attributes to assign values to. |
7 | SdaiSelect | attributeValues | A buffer of pointers to tSdaiSelect structures. Each structure defines the type and value to be assigned to the attribute with the name given by the element of <attributeNames> with the same buffer position. |
8 | SdaiOptions | options | Currently not used. |
9 | SdaiAppInstance | newInstanceId | A variable that will receive a numeric instanceID that uniquely identifies the created instance in the remote EDMdatabase. |
10 | SdaiInvocationId | edmiInvocationId | Currently not used. |
Return Value
Options
Option | Comment |
Option name | Comment |
Example
EdmiError rstat; SdaiServerContext myContext; SdaiInstance instId; SdaiModel modelId; SdaiEntity entityId; SdaiString name = "Lucy Scmidt"; SdaiAttr attrIds[4]; tSdaiSelect sel[4], *ps; SdaiSelect attrVals[4] = {&sel[0], &sel[1], &sel[2], &sel[3]}; /* Create Server Context */ rstat = edmiDefineServerContext("MyContext", "Johnny", "Supervisor", "cf37ftr", "TCP", "9090", "MyServerHost", NULL, NULL, NULL, NULL, NULL, &myContext); /* Get the model Id */ rstat = edmiRemoteGetModelBN(myContext, "DataRepository", "MySocialNetwork", &modelId, NULL); /* Get the entity Id */ rstat = edmiRemoteGetEntity(myContext, modelId, "PERSON", &entityId, NULL); /* Get the attribute Ids */ rstat = edmiRemoteGetAttrDefinitionBN(myContext, "SocialNetwork", "Person", "NAME", &attrIds[0], NULL); rstat = edmiRemoteGetAttrDefinitionBN(myContext, "SocialNetwork", "Person", "AGE", &attrIds[1], NULL); rstat = edmiRemoteGetAttrDefinitionBN(myContext, "SocialNetwork", "Person", "WEIGHT", &attrIds[2], NULL); rstat = edmiRemoteGetAttrDefinitionBN(myContext, "SocialNetwork", "Person", "MARRIED", &attrIds[3], NULL); /* The NAME attribute */ ps = attrVals[0]; ps->nTypes = 0; ps->typeList = NULL; ps->type = sdaiSTRING; ps->value.stringVal = name; /* The AGE attribute */ ++ps; ps->nTypes = 0; ps->typeList = NULL; ps->type = sdaiINTEGER; ps->value.intVal = 32; /* The WEIGHT attribute */ ++ps; ps->nTypes = 0; ps->typeList = NULL; ps->type = sdaiREAL; ps->value.realVal = 59.5; /* The MARRIED attribute */ ++ps; ps->nTypes = 0; ps->typeList = NULL; ps->type = sdaiBOOLEAN; ps->value.boolVal = sdaiFALSE; /* Add lucy to my social network */ rstat = edmiRemoteCreateInstanceAndPutAttrsEx(myContext, modelId, entityId, 4, attrIds, attrVals, 0, &instId, NULL); . . .
See also
Filter by label
There are no items with the selected labels at this time.