edmiRemotePutAttrs

EdmiError edmiRemotePutAttrs(SdaiServerContext serverContextId,
                              SdaiAppInstance   instance, 
                              SdaiInteger       attributes, 
                              SdaiInvocationId  *edmiInvocationId, 
                              /* [SdaiAttr attributeId,  SdaiPrimitiveType valueType,SdaiVoid data] */
                               ...);


Assigns values to one or more of the attributes of a specified instance. This operation is applicable only to Explicit attributes, not to Inverse or Derive attributes. The attributes are identified by their attributeIds.

Arguments


TypeNameComment
SdaiServerContext

serverContextId

Context identification, from edmiDefineServerContext

SdaiAppInstance

instance

A numeric instanceID that uniquely identifies an instance in the remote  EDMdatabase

SdaiInteger

attributes

The number of attributes for which to assign values.

SdaiInvocationId

edmiInvocationId

Currently not used.

 

values

For each attribute value to assign the three following arguments in the following order have to be specified:

  1. SdaiAttr attributeID: A numeric identifier that uniquely identifies an attribute definition instance in the remote EDMdatabase
  2. SdaiPrimitiveType   valueType : The primitive type of the <value> argument. This type must be must be the same or compatible with the data type of the actual attribute domain as it is defined in the attribute declaration of the underlying Express Schema.  All data types except sdaiAGGR can be handled by this operation. Aggregates may not be assigned to attributes by this operation. They must be created explicitly by appropriate aggregate operations.  sdaiSELECT can be used to write all data types. sdaiADB can be used to write all data types except typed values.
    sdaiINTEGER is compatible with sdaiREAL. sdaiBOOLEAN is compatible with sdaiLOGICAL. Conversion between compatible data types will be performed automatically when required.
  3. SdaiVoid value : The data value to assign to the attribute of the specified instance. The type of <value> must be the same as specified in the <valueType> argument.

Return Value


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

 

Options


  

 

Example


 

 #define S_NAT 0
 #define S_PHONE 1
 #define S_NATTR 2
 int i;
 EdmiError rstat;
 SdaiServerContext myContext;
 SdaiInteger index, nHits;
 SdaiQueryResult qexRes;
  
 /* Create Server Context */
 rstat = edmiDefineServerContext("MyContext",
 "Johnny", "Supervisor", "cf37ftr", 
 "TCP", "9090", "MyServerHost", 
 NULL, NULL, NULL, NULL, NULL, &myContext); 
  
 /* Select all person instances */
 rstat = edmiRemoteSelectInstances(myContext, "MyRepository",
 "MySocialRelations", "Person", 
 NULL, ONLY_INSTANCE_IDS, NULL, NULL, NULL,  
 &index, &nHits, &qexRes, NULL, NULL, NULL, NULL); 
  
 /* Get nationality and phone number */
 for (i=0;i<nHits;i++) {
 char _phoneNumber[12];
 SdaiAttr _attrIds[S_NATTR]; 
 SdaiEnumeration _nationality; 
 SdaiString _phoneNo; 
  
 /* Get the persons nationality attribute ID */ 
 rstat = edmiRemoteGetAttrDefinitionBN(myContext, "SocialRelations", 
 "Person", "NATIONALITY", &_attrIds[S_NAT], NULL); 
  
 /* And his phone number attribute ID */ 
 rstat = edmiRemoteGetAttrDefinitionBN(myContext, "SocialRelations", 
 "Person", "PHONE_NO", &_attrIds[S_PHONE], NULL); 
  
 rstat = edmiRemoteGetAttrs(myContext,  
 qexRes->instanceIds[i], 0, S_NATTR, NULL, 
 __attrIds[S_NAT], sdaiENUMERATION, &_nationality, 
 _attrIds[S_PHONE], sdaiSTRING, &_phoneNo); 
  
 /* Set correct nationality code */ 
 if (! strcmp(_nationality, "NOR")) {  
 strcpy(_phoneNumber, "+47-"); 
 } else if (! strcmp(_nationality, "SWE")) { 
 strcpy(_phoneNumber, "+44-"); 
 } else if (! strcmp(_nationality, "DEN")) { 
 strcpy(_phoneNumber, "+45-"); 
 } else { 
 strcpy(_phoneNumber, "+??-"); 
 } 
  
 /* Concatenate the original phone number */ 
 strcat(_phoneNumber, _phoneNo); 
  
 /* Free allocated strings in the 
 select buffers */ 
 edmiFree(_nationality); 
 edmiFree(_phoneNo); 
  
 /* Put back the extended phone number */ 
 rstat = edmiRemotePutAttrsBN(myContext, 
 qexRes->instanceIds[i], 1, NULL, 
 &_attrIds[S_PHONE], sdaiSTRING, &_phoneNumber); 
 }
 edmiFreeQueryResult(qexRes);
 . . .

 

See also

Filter by label

There are no items with the selected labels at this time.

Â