sdaiGetADBValue
Returns the data value in the specified ADB container. The specified primitive type <valueType> must be the same as the actual data type in the ADB container or a 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 value. The primitive type sdaiINTEGER is compatible with sdaiREAL, and sdaiBOOLEAN is compatible with sdaiLOGICAL, hence conversion between these compatible data types will be performed when required.
Related functions: sdaiCreateADB , sdaiPutADBValue , sdaiGetADBType
Header:
#include "sdai.h"
Prototype:
void *sdaiGetADBValue(SdaiADBÂ Â Â Â Â Â Â Â Â Â Â Â adbId,
                       SdaiPrimitiveType  valueType,Â
                       void               *value);Â
Arguments:
adbId |
A numeric adbID that uniquely identifies the actual ADB container to operate on. |
valueType |
The data type, i.e. the primitive type of the data value to be retrieved. This <valueType> must be the same or a compatible type of the primitive type of the value in the actual ADB container. The primitive type sdaiSELECT can be used to read all data types. The primitive type sdaiADB can be used to read all data types except typed values. |
value |
The variable that will hold a copy of the data value read from the actual ADB container. The data type of <value> must be the same or a compatible type of <valueType>. |
Returns:
void * = address of <value> : operation successfully performed.
void * = NULL: error during operation – use sdaiErrorQuery function to get error reason.
Example:
SdaiADB adbId;
SdaiAppInstance anInst;
SdaiPrimitiveType datatype;
SdaiInteger myInt;
SdaiString myString;
void *p;
...
adbId = sdaiCreateEmptyADB();
. . .
sdaiGetAttrBN(anInst, "attr", sdaiADB, (void *) &adbId);
datatype = sdaiGetADBType(adbId);
switch (datatype) {
case sdaiINTEGER:Â
p = sdaiGetADBValue(adbId, datatype, (void *) &myInt);Â
break;Â
case sdaiSTRING:Â
p = sdaiGetADBValue(adbId, datatype, (void *) &myString);Â
break;Â
. . .Â
}
if (p == NULL) {
/* Error in operation */Â
printf("\nError: %s in sdaiGetADBValue \n",Â
edmiGetErrorText(sdaiErrorQuery()));Â
goto error;Â
}
. . .