> DNU home > code projects page 1
Searching for Attribute Values - Source Code Details 3
DeveloperNet University Article

Once the expression has been composed in the search filter, the filter is packaged in an NDS request buffer with the NWDSPutFilter call.

The prototype for NWDSPutFilter is shown below:

 (NWDSCCODE) NWDSPutFilter (NWDSContextHandle context, Buf_T *reqBuf,  pFilterCursor_T filterCursor, void (N_FAR N_CDECL *freeVal) (nuint32 syntax, nptr val) );

context Specifies the NDS context for the request.

reqBuf Points to the request buffer containing the search filter.

filterCursor Points to the search filter.

freeVal App defined function to free the values added to filter expression.

syntax freeVal parameter specifies the syntax for the value to be freed.

val freeVal parameter points to the memory to be freed.

Note: Non-zero return values from NWDSPutFilter indicate an error. To understand handling client side NDS errors, refer to handling_errors.

NWDSPutFilter frees the area allocated to the search filter, including the area referenced by filterCursor. If the application needs to retain the filter (expression tree), the application should save the filter in some form before calling NWDSPutFilter.

Note: NWDSPutFilter always frees the memory allocated to the filter, even if NWDSPutFilter returns an error. Do not call NWDSFreeFilter to free the filter if NWDSPutFilter returns an error. Doing so will corrupt memory since the filter will already have been freed.

The freeVal parameter points to an application-defined function to free the attribute values referenced by the search filter in filterCursor. The function is passed the syntax attribute ID (see Table 1) and the address of the area to free. The freeVal parameter can be NULL, in which case no attribute values are freed. In our example, the attribute values are stack variables or are freed by the calling function, so the freeVal parameter is NULL.

Table 1: Syntax IDs



PREVIOUSblankTop of PageblankNEXT