edmiRemoteFindInstancesBNEx
EdmiError edmiRemoteFindInstancesBNEx(SdaiServerContext serverContextId, SdaiString remoteRepositoryName, SdaiString remoteModelName, SdaiString entityName, SdaiString condition, SdaiInteger maxBufferSize, SdaiInteger *index, SdaiInteger *numberOfHits, SdaiInstance *resultBuffer, SdaiInvocationId *edmiInvocationId);
Search in a specified remote edmModel for instances of a given type that match a specified condition. The condition must be a simple conditional statement addressing only the simple type attribute values of the instances. A NULL or empty string condition will match All instances of the specified type in the specified edmModel. Each matching instance is identified by its unique numeric instanceID. All instances of a the specified type is held in an entity extent instance aggregate. It is this instance aggregate that will be queried for matching instances. The index of the first instance aggregate element to check, 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 instance aggregate" are returned from the operation. This makes it possible to query through huge amounts of instances in an entity extent aggregate by means of a loop where each iteration handles small subset of the total instance aggregate. When the <maxBufferSize> argument is zero and the <resultBuffer> argument is NULL. Nothing but the number of matching instances will be returned.
Arguments
Type | Name | Comment |
SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
SdaiString    | remoteRepositoryName | Name of the edmRepository in the remote EDMdatabase that contains the edmModel. |
SdaiString | remoteModelName | The name of the edmModel in the remote EDMdatabase that contains the instances to query. |
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 underlying Express Schema of the edmModel specified by the <remoteModelName> argument. |
SdaiString | condition | The condition that the instances in the entity extent instance aggregate shall match. A NULL or empty string condition will match all the instances. The condition statement must be on the form "attribute = value" |
SdaiInteger | maxBufferSize | The size of the buffer (in number of bytes) in which all the matching instances will be returned. The number of returned elements may never exceed the maximum number of instances that may be contained by a buffer with this size. |
SdaiInteger | index |
|
SdaiInteger | numberOfHits |
|
SdaiInstance | resultBuffer | A buffer, allocated by the calling application, that will receive the instanceIDs of the matching instances. Use the <maxBufferSize> argument to prevent writing past the end of this buffer. |
SdaiInvocationId | edmiInvocationId | Currently not used. |
Return Value
Â
Options
 Â
Â
Example
Â
 #define S_BUFFSIZE 10 int i; EdmiError rstat; SdaiServerContext myContext; SdaiInstance buff[10]; 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 */ nTot = nTot = 0; nHits = S_BUFFSIZE; while (nHits == S_BUFFSIZE) { rstat = edmiRemoteFindInstancesBNEx(myContext, "MyRepository", "MySocialRelations", "MyFriends", "PROFESSION = 'Carpenter'", S_BUFFSIZE * sizeof(SdaiInstance), &index, &nHits, &buff[0], NULL); /* Get names and phone numbers */ for (i=0;i<nHits;i++) { SdaiString _attrName[3] = {"FIRST_NAME", "LAST_NAME", "PHONE_NO"}; tSdaiSelect _sel[3]; SdaiSelect _attrVal[3] = {&_sel[0], &_sel[1], &_sel[2]}; rstat = edmiRemoteGetAttrsBNEx(myContext, buff[i], 0, 3, _attrName, _attrVal, GET_ATTRS, NULL); printf("\n%s %s, Phone No. %s", _sel[0].value.stringVal, _sel[1].value.stringVal, _sel[2].value.stringVal); } nTot += nHits; ++index; } printf ("\n%d carpenters found among my friends!"); . . .
Â
See also
Filter by label
There are no items with the selected labels at this time.
Â