Prepares a search filter expression tree in a request buffer so it can be used in a call to NWDSSearch.
#include <nwnet.h> or #include <nwdsfilt.h> N_EXTERN_LIBRARY (NWDSCCODE) NWDSPutFilter ( NWDSContextHandle context, pBuf_T buf, pFilter_Cursor_T cur, void (N_FAR N_CDECL *freeVal)( nuint32 syntax, nptr val) );
uses netwin32 Function NWDSPutFilter (context : NWDSContextHandle; buf : pBuf_T; cur : pFilter_Cursor_T; freeVal : FreeValProc ) : NWDSCCODE;
(IN) Specifies the NDS context for the request.
(IN) Points to the request buffer being prepared.
(IN) Points to a cursor to the filter expression tree being stored in the buffer.
(IN) Points to the function used to free the attribute values.
0x0000 0000 |
SUCCESSFUL |
nonzero value |
Nonzero values indicate errors. See |
The buf parameter points to a Buf_T, which is allocated by NWDSAllocBuf and initialized for a DSV_SEARCH_FILTER operation by NWDSInitBuf.
NWDSPutFilter frees the area allocated to the expression tree, including the area referenced by cur. If the application needs to retain the expression tree, the application should save the tree in some form before calling NWDSPutFilter.
NOTE:NWDSPutFilter always frees the memory allocated to the expression tree, 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 a function freeing the attribute values. The function is passed the syntax attribute ID and the address of the area to free. The freeVal parameter can be NULL, in which case no attribute values are freed.