edmiFindInstancesBN
EdmiError edmiFindInstancesBN(SdaiModel model, SdaiString entityName, SdaiString condition, SdaiInteger maxBufferSize, SdaiInteger *index, SdaiInteger *numberOfHits, SdaiInstance *resultBuffer);
Search in the specified model for instances of the specified type that match the specified condition. The condition is specified as attribute values of the instances. All instances of the specified type in the specified model will match an empty condition, i.e. the <condition> argument set to NULL. Each matching instance is identified by a numeric instanceID that uniquely identifies an instance in the EDMdatabase. All instances of a particular type is hold in an entity extent aggregate, hence this aggregate will be queried for matching instances. The index of the first entity extent aggregate element to test for an instance that match the specified condition, and the maximum number of matching instances to return, are specified as input arguments to the function. The actual number of matching instances returned and the "index of the last returned matching instance in the entity extent aggregate" are returned from the operation. This makes it convenient to query the entity extent aggregate by the edmiFindInstancesBN function in an incremental way. The actual model to query must be open before this operation can be successfully performed. When the input arguments <maxBufferSize> == 0 & <resultBuffer> == NULL no instanceId or elementNumber will be returned. Only the number of matching instances/elements will be returned.
Arguments
Type | Name | Comment |
SdaiModel | model | A numeric modelID that uniquely identifies the model in the EDMdatabase to query for instances that matches the specified conditions. The modelID is returned when the model is created or it can be retrieved by one of the following operations: edmiGetModel , edmiGetModelBN , sdaiGetInstanceModel |
SdaiString | entityName | Name of the ENTITY that defines the instance type to query. ENTITY names are case insensitive. The ENTITY must be defined in the schema that is the underlying schema of the model specified by the <model> argument. |
SdaiString | condition | Specifies the condition the target instances should match. All instances in the specified aggregate match an empty condition, i.e. <condition> = NULL. |
SdaiInteger | maxBufferSize | Specifies the size (in number of bytes) of the buffer to receive the instanceID of the matching instances. The actual number of returned matching instances will never be greater than the number of instanceID that can be placed in a buffer of the size specified by this argument. |
SdaiInteger | index |
|
SdaiInteger | numberOfHits |
|
SdaiInstance | resultBuffer | Address of a buffer in the calling application that will receive the instanceID of each returned matching instance. This buffer is mapped to a SdaiInstance array when the instanceID of each returned matching instance is stored. The <maxBufferSize> argument should prevent the function to write past buffer. |
Return Value
Options
Â
Example
Â
SdaiModel modelId; int i; SdaiInteger index,hits; SdaiInstance resultBuffer[MAX_ELEMENTS]; ... index = 0; /* start on first aggregate element */ hits = MAX_ELEMENTS; /* max number of hits */ if (rstat = edmiFindInstancesBN(modelId, "Product", "Document <> NULL", sizeof(resultBuffer), &index, &hits, resultBuffer)) { /* Error in operation */ printf("\nError: %s in edmiFindInstancesBN\n", edmiGetErrorText(rstat)); goto error; } /* print out the instanceID of the matching instances */ for (i = 0; i < hits; i++) { printf("\nInstance: #%12ld", resultBuffer[i]); } ...
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â