Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
Returns the aggregate descriptor information of a specified aggregate in a remote EDMdatabase.
Related functions:
Prototype:
EdmiError edmiRemoteGetAggrDescr(SdaiServerContext serverContextId,
                                  SdaiAggr          aggrId,
                                  SdaiAggrType      *aggrType,
                                  SdaiInteger       *lowerBound,
                                  SdaiInteger       *upperBound,
                                  SdaiInstance      *elementId,
                                  SdaiInstance      *domainId,
                                  SdaiBoolean       *optional,
                                  SdaiBoolean       *unique,
                                  SdaiPrimitiveType *datatype,
                                  SdaiInteger       *members,
                                  SdaiInvocationId  *edmiInvocationId);
 
Arguments:

serverContextId

Context identification, from edmiDefineServerContext

aggrId

A numeric aggregateID that uniquely identifies the aggregate of interest in the remote _EDMdatabase._

aggrType

A variable that will receive the type of aggregate. Possible aggregate types are: sdaiLIST, sdaiARRAY, sdaiSET and sdaiBAG.

lowerBound

A variable that will receive the declared lower bound of the aggregate. This value may be found in the attribute declaration in the underlying Express Schema of the edmModel that contains the aggregate.
a : ARRAY [2:12] OF UNIQUE OPTIONAL STRING;

upperBound

A variable that will receive the declared upper bound of the aggregate. This value may be found in the attribute declaration in the underlying Express Schema of the edmModel that contains the aggregate.
a : ARRAY [2:12] OF UNIQUE OPTIONAL STRING;

elementId

A variable that will receive a domainId that uniquely identifies the type of the aggregate elements in the remote _EDMdatabase{_}. This domainId identifies the declaration of the element type in the meta model that was initially stored in the database when the underlying Express Schema was compiled.

domainId

A variable that will receive a domainId that uniquely identifies the aggregate within the remote _EDMdatabase{_}. This domainId identifies the aggregate declaration in the meta model that was initially stored in the database when the underlying Express Schema was compiled.

optional

A variable that will be set to sdaiTRUE if the aggregate elements are optional. Will be set sdaiFALSE if they are mandatory. This property may be found in the attribute declaration in the underlying Express Schema of the edmModel that contains the aggregate.
a : ARRAY [2:12] OF UNIQUE OPTIONAL STRING;

unique

A variable that will will be set to sdaiTRUE if the aggregate elements must be unique. Otherwise, it will be set to sdaiFALSE. This property may be found in the attribute declaration in the underlying Express Schema of the edmModel that contains the aggregate.
a : ARRAY [2:12] OF UNIQUE OPTIONAL STRING;

datatype

A variable that will receive the primitive type of the aggregate elements. This property may be found in the attribute declaration in the underlying Express Schema of the edmModel that contains the aggregate.
a : ARRAY [2:12] OF UNIQUE OPTIONAL STRING;

members

A variable that will receive the number of elements contained in the aggregate.

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:
/*
SCHEMA Employees 
ENTITY person; 
Name : STRING; 
Age : INTEGER; 
END_ENTITY; 
 
ENTITY Manning; 
DivisionStaff : ARRAY [0:4] OF SET OF person; 
END_ENTITY; 
END_SCHEMA; 
*/
int i;
EdmiError rstat;
SdaiInteger nHits, nEmployees, index;
SdaiServerContext myContext;
SdaiInstance manningId;
SdaiAggr parentAggrId, childAggrId;
SdaiQueryResult qexRes;
SdaiAggrType aggrType;
SdaiInteger lowerBound, upperBound, members;
SdaiInstance elementId, domainId;
SdaiBoolean isOptional, isUnique;
SdaiPrimitiveType dataType;
 
/* Create Server Context */
rstat = edmiDefineServerContext("MyContext",
"Johnny", "Supervisor", "cf37ftr", 
"TCP", "9090", "MyServerHost", 
NULL, NULL, NULL, NULL, NULL, &myContext); 
 
/* Get the manningId instance. It is assumed that
there is only one instance of type Manning */ 
index = 0;
nHits = 1;
rstat = edmiRemoteSelectInstances(myContext, "AdminRepository",
"Employees", "Manning", NULL, ONLY_INSTANCE_IDS, 
NULL, NULL, NULL, &index, &nHits, &qexRes,  
NULL, NULL, NULL, NULL); 
manningId = qexRes->instanceIds[0];
edmiFreeQueryResult(qexRes);
 
/* Get the parent aggregate Id */
rstat = edmiRemoteGetAttrsBN(myContext, manningId, 0, 1, NULL,
"DivisionStaff", sdaiAGGR, &parentAggrId); 
 
/* Get the parent aggregate descriptor */
rstat = edmiRemoteGetAggrDescr(myContext, parentAggrId,
&aggrType, &lowerBound, &upperBound,  
&elementId, &domainId, &isOptional,  
&isUnique, &dataType, &members, NULL); 
 
/* Count the employees in all divisions */
for (i=lowerBound; i<=upperBound; i++) {
rstat = edmiRemoteGetAggrElement(myContext, parentAggrId,  
0, i, sdaiAGGR, &childAggrId, NULL); 
rstat = edmiRemoteGetMemberCount(myContext, 
childAggrId, 0, &nEmployees, NULL); 
printf("\nDivision %d: %d employees.", i, nEmployees); 
}
. . .

  • No labels