ldap_create_sort_control()--Create a Sorted Results Control used when Sorting Search Results
Syntax
#include <ldap.h> int ldap_create_sort_control( LDAP *ld, LDAPsortkey **sortKeyList, const char isCritical, LDAPControl **control)
Library Name/Service Program: QSYS/QGLDCLNT
Default Public Authority: *USE
Threadsafe: Yes
The ldap_create_sort_control() function is used to create a sorted results control used when sorting search results.
See Sorted LDAP Search Results for usage information about the functions used to perform sorting of entries returned from the server following an LDAP search operation.
Authorities and Locks
No IBM® i authority is required. All authority checking is done by the LDAP server.
Parameters
- ld
- (Input) Specifies the LDAP pointer returned by previous call to ldap_init(), ldap_ssl_init() or ldap_open(). Must not be NULL.
- sortKeyList
- (Input) Specifies the pointer to an array of LDAPsortkey structures, which represent attributes that the server uses to sort returned entries. This is obtained by a previous call to ldap_create_sort_keylist().
- isCritical
- (Input) Specifies the criticality of sort on the search. If the criticality of sort is FALSE, and the server finds a problem with the sort criteria, the search continues but entries returned are not sorted. If the criticality of sort is TRUE, and the srver finds a problem with the sort criteria, the search does not continue, no sorting is done, and no entries are returned. If the server does not find any problem with the sort criteria, the search and sort continues and entries are returned sorted.
- control
- (Output) Specifies the result parameter that is filled in with an allocated array of one control for the sort function. The control must be freed by calling ldap_control_free().
Return Value
- LDAP_SUCCESS
- if the request was successful.
- LDAP_PARAM_ERROR
- if ld, sortKeyList or control is NULL.
- LDAP_NO_MEMORY
- if memory cannot be acquired.
- LDAP_ENCODING_ERROR
- if an underlying ber encoding function fails.
Example
See the example that uses ldap_create_sort_keylist(), ldap_create_sort_control(), ldap_free_sort_keylist(), and ldap_parse_sort_control() to perform an LDAP sorted search in ldap_create_sort_keylist() --Create a Structure with Sort Key Values used when Sorting Search Results.
Related Information
- ldap_create_sort_keylist() -- Create a structure with sort key values.
- ldap_free_sort_keylist() -- Free all memory used by the sort key list.
- ldap_parse_sort_control() -- Retrieve values in a sorted results control.
- ldap_create_page_control() -- Create a paged results control.
- ldap_parse_page_control() -- Retrieve values in a paged results control.
- ldap_search() -- Asynchronously search the directory.
- ldap_parse_result() -- Extract information from results.
- ldap_init() -- Initializes a session with an LDAP server.
- ldap_ssl_init() -- Initializes an SSL connection
- ldap_open() -- Open a connection to an LDAP server
API introduced: V5R3
[ Back to top | LDAP APIs | APIs by category ]