Implements the Express Query operation as defined in section 12.6.7 Query expression in ISO 10303-11:1994(E) : The EXPRESS Language Reference Manual.
The data model that hosts the source aggregate of the operation must be open before this operation can be successfully performed.
The edmiQuery operation is fully processed by the EDMexpressVM.
Related functions: edmiSelectInstancesBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiQuery(SdaiAggr sourceAggr,
SdaiString condition,
SdaiInteger options,
SdaiInteger *membersInResult,
SdaiPrimitiveType *elementType,
SdaiBoolean **elementsValueSet,
void *result);
Arguments:
sourceAggr |
A numeric aggregateID that uniquely identifies the source aggregate to be queried. |
condition |
Any legal symbolic Express-X logical expression. This <condition> argument will be compiled by the EDMexpressXCompiler |
options |
Specifies the options to be used in the invocation of the edmiQuery function. The <options> value can be specified as a bitwise OR between the actual options to enable. All option names are defined on the header file sdai.h . |
membersInResult |
Address of a SdaiInteger variable that will receive the returned number of elements in the result data set. |
elementType |
Address of a SdaiPrimitiveType variable that will receive the primitive type of the resulting data set. |
elementsValueSet |
Address of a SdaiBoolean array. The index range of this array is: |
result |
Address of a void* variable that will receive the resulting data set. The data type and value of the resulting data set is dependent of the <options> argument. |
Option Description
AS_SCRATCH_AGGR |
The result of the operation will be returned in a new created scratch aggregate. The aggregate type is dependent of the aggregate type of the source aggregate <sourceAggr>, and will be according to the definition of the operation in the EXPRESS language. |
AS_MEMORY_BUFFER |
The operation result aggregate will be returned as a memory buffer in the calling application's virtual memory. The memory address (byte address) of the memory buffer will be returned in the <result> argument. |
IN_OPERAND1 |
The result of the operation will be in the aggregate specified in the <sourceAggr> argument. Hence the original value in the <sourceAggr> aggregate will be overwritten by the operation. |
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
EdmiError rstat;
SdaiAggr sourceAggr;
SdaiInteger membersInResult;
SdaiPrimitiveType elementType;
SdaiBoolean *elementsValueSet;
SdaiInstance *p, *result;
int i;
. . .
if (rstat = edmiQuery(sourceAggr,
"Exists(Father) AND (SizeOf(Mother.children) > 2)",
AS_MEMORY_BUFFER,
&membersInResult,
&elementType,
&elementsValueSet,
(void *) &result)) {
/* Error in operation */
printf("\nError: %s in edmiQuery\n",
edmiGetErrorText(rstat));
goto error;
}
/* Print out the returned instanceIds */
p = result;
for (i = 0; i < membersInResult; i++) {
printf("\nInstanceID: %10lu",*p);
++p;
}
edmiFree(result);
. . .