edmiRemoteCreateNestedAggrAndWriteAggrElements
Â
EdmiError edmiRemoteCreateNestedAggrAndWriteAggrElements(SdaiServerContext serverContextId, SdaiAggr parentAggrId, SdaiAggrFunction aggrFunction, SdaiAggrIndex aggrIndex, SdaiAggrIndex elementIndex, SdaiInteger elements, SdaiPrimitiveType datatype, SdaiVoid dataValues, SdaiAggr *newAggrId, SdaiInvocationId *edmiInvocationId);
Creates a nested aggregate within an already existing aggregate and inserts any number of given data values in the nested aggregate. The existing aggregate is denoted the parent aggregate. The nested aggregate to be created is denoted the child aggregate of its parent aggregate. The type of child aggregate that results from this operation is determined by the aggregate element declaration of the parent aggregate in the underlying Express Schema of the edmModel. Suppose the declaration of the attribute myAttr is;
myAttr : LIST [1:3] OF ARRAY [1:12] OF STRING;
This function would create an array of 12 elements within one of the three elements of the list. The list would have to be created and identified by its aggregateId before invoking this function. A numeric aggregateID will be returned from the function. This id uniquely identifies the child aggregate within the remote EDMdatabase. This aggregateID will remain unchanged throughout the lifetime of the child aggregate and may be used to identify it in subsequent calls to EDMinterface API functions. The parent aggregate that will be the owner of the nested child aggregate is specified by its aggregateId in the <parentAggr> argument. AggregateIDs may not be considered plain data values. Nested child aggregates must be created within their parent aggregates. Child aggregateIds may be retrieved by EDMinterface Get operations, but they may not be used to populate parent aggregates by means of EDMinterface Put operations. This operation is only applicable to aggregates owned by application instances.
Arguments
Â
1 | Type | Name | Comment |
2 | Â SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
3 | Â SdaiAggr | parentAggrId | A numeric aggregateID that uniquely identifies the aggregate of interest in the remote EDMdatabase |
4 | Â SdaiAggrFunction | aggrFunction | Determines the insert point of the created nested aggregate in its parent aggregate. This argument has no effect on the ordering of the elements that are written to the created nested aggregate. The following is a description of each of the legal values of this argument.
|
5 | Â SdaiAggrIndex | aggrIndex | The parent aggregate element position in which the child aggregate will be inserted. |
6 | Â SdaiAggrIndex | elementIndex | The child aggregate element to start inserting the values given in the <dataValues> aggregate. This argument is applicable for Array aggregates only. Note that the index range of an array is declared in the underlying Express Schema of the edmModel. The declared lower and upper bounds of the index range for an array may be obtained by the function edmiRemoteGetAggrDescr. |
7 | Â SdaiInteger | elements | The number of elements to write to the specified nested aggregate. |
8 | Â SdaiPrimitiveType | datatype | Currently, this function can only handle the datatype sdaiSELECT. |
9 | Â SdaiVoid | dataValues | A buffer of tSdaiSelect data stuctures. Each element contains a value to be written to the created nested aggregate. |
10 | Â SdaiAggr | newAggrId | Variable that will receive the aggregateId that uniquely identifies the nested aggregate in the remote EDMdatabase. |
11 | Â SdaiInvocationId | edmiInvocationId | Currently not used. |
Return Value
Â
Options
 Â
Â
Example
Â
 /* SCHEMA Employees ENTITY person; Name : STRING; Age : INTEGER; END_ENTITY; ENTITY Manning; DivisionStaff : ARRAY [0:4] OF SET OF person; END_ENTITY; END_SCHEMA; */ #define S_NOOF_DIVISIONS 5 int i; EdmiError rstat; SdaiServerContext myContext; SdaiInstance manningId, johnnyId, lucyId; SdaiAggr parentAggrId; SdaiAggr childAggrId[S_NOOF_DIVISIONS]; /* Create Server Context */ rstat = edmiDefineServerContext("MyContext", "Johnny", "Supervisor", "cf37ftr", "TCP", "9090", "MyServerHost", NULL, NULL, NULL, NULL, NULL, &myContext); /* Create instance of Employees */ rstat = edmiRemoteCreateInstanceAndPutAttrsBN(myContext, "AdminRepository", "Employees", "Manning", 0, &manningId, NULL); /* Create the parent aggregate */ rstat = edmiRemoteCreateAggrAndWriteAggrElementsBN(myContext, manningId, "DivisionStaff", 0, 0, 0, NULL, &parentAggrId, NULL); /* Create Johnny */ rstat = edmiRemoteCreateInstanceAndPutAttrsBN(myContext, "AdminRepository", "Employees", "Person", 2, &johnnyId, NULL, "NAME", sdaiSTRING, "Johnny", "AGE", sdaiINTEGER, 32); /* Create Lucy */ rstat = edmiRemoteCreateInstanceAndPutAttrsBN(myContext, "AdminRepository", "Employees", "Person", 2, &lucyId, NULL, "NAME", sdaiSTRING, "Johnny", "AGE", sdaiINTEGER, 32); /* Create child aggregates for all company divisions Johnny and Lucy are employees of all divisions */ for (i=0;i<S_NOOF_DIVISIONS;i++) { SdaiInstance _staff[2] = {johnnyId, lucyId}; rstat = edmiRemoteCreateNestedAggrAndWriteAggrElements(myContext, parentAggrId, ACCESS_BY_INDEX, i, 0, 2, sdaiINSTANCE, _staff, &childAggrId[i], NULL); } . . .
Â
See also
Filter by label
There are no items with the selected labels at this time.