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 value of the one or more specified attributes of an application instance. The instance is specified by its numeric instanceID that uniquely identifies it in the remote EDMdatabase. The attributer are identified by their names.
Related function: edmiRemoteGetAttrs
Header:
#include "sdai.h"
Prototype:
EdmiError edmiRemoteGetAttrsBN(SdaiServerContext serverContextId,
                                SdaiInstance      instance, 
                                SdaiVersion       version, 
                                SdaiInteger       numberAttr, 
                                SdaiInvocationId  *edmiInvocationId, 
                                /* [SdaiString attributeName, SdaiPrimitiveType valueType, void *value] */ 
                                  ...); 
 
Arguments:

serverContextId

Context identification, from edmiDefineServerContext

instance

A numeric instanceID that uniquely identifies the instance of interrest in the remote _EDMdatabase{_}.

version

The version of the edmModel to apply this function call on. The <version> parameter is a numeric sequence number counting from one by increments of one for each new model version that is created. A zero model version number means the current version.

numberAttr

The number of attributes for which to to assign values.

edmiInvocationId

Currently not used.

value

For each attribute value to read the following three arguments must be specified:

  1. <attributeName> : The name of the attribute for which to read its value.
  2. <valueType> : The primitive type of the attribute. This type must be the same as the actual data type of the attribute value or any compatible data type. The primitive type sdaiSELECT can be used to get all data types. The primitive type sdaiADB can be used to get all data types except typed values. The primitive type sdaiINTEGER is compatible with sdaiREAL, and sdaiBOOLEAN is compatible with sdaiLOGICAL, hence conversion between these compatible data types will be performed automatically when required.
  3. <value> : The variable that will hold receive the data value from the actual attribute.

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:
#define S_BATCHSIZE 10
int i;
EdmiError rstat;
SdaiServerContext myContext;
SdaiInteger index, nHits, nTot;
 
/* Create Server Context */
rstat = edmiDefineServerContext("MyContext",
"Johnny", "Supervisor", "cf37ftr", 
"TCP", "9090", "MyServerHost", 
NULL, NULL, NULL, NULL, NULL, &myContext); 
 
/* Find carpenters among my friends
and their fathers. Read them in 
batches of 10 */ 
nTot = 0;
index = 0;
nHits = S_BATCHSIZE;
while (nHits = S_BATCHSIZE) {
SdaiQueryResult _qexRes; 
SdaiString _firstName, _lastName, _phoneNo; 
 
rstat = edmiRemoteSelectInstances(myContext, "MyRepository", 
"MySocialRelations", "MyFriends", 
"(SELF.PROFESSION.NAME = 'Carpenter') OR \ 
(FATHER.PROFESSION.NAME = 'Carpenter')", 
ONLY_INSTANCE_IDS, NULL, NULL, NULL, 
&index, &nHits, &_qexRes, NULL, NULL, NULL, NULL); 
 
/* Get names and phone numbers */ 
for (i=0;i<nHits;i++) {
rstat = edmiRemoteGetAttrsBN(myContext,
_qexRes->instanceIds[i], 0, 3, NULL,  
"FIRST_NAME", sdaiSTRING, &_firstName, 
"LAST_NAME", sdaiSTRING, &_lastName, 
"PHONE_NO", sdaiSTRING, &_phoneNo); 
 
printf("\n%s %s, Phone No. %s", _firstName, _lastName, _phoneNo); 

edmiFreeQueryResult(_qexRes); 
nTot += nHits; 
++index; 
}
printf ("\n%d carpenters found among my friends!");
. . .

  • No labels