Re: LDAP V3 Server Side Sorting

From: Date: Wed, 16 May 2001 15:52:52 +0000
Subject: Re: LDAP V3 Server Side Sorting
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-55501@lists.php.net to get a copy of this message
If we are to follow the Netscape API then we should have a ldap_search_ext() function which we can pass the results of the ldap_create_sort_control(), other server side and client side controls. We can then incorporate "Virtual List View Control" and "Entry Change Notification Control" along with the rest of LDAP Version 3 functionality. David On Wed, 16 May 2001, Stig Venaas wrote: > On Tue, May 15, 2001 at 06:17:11PM -0700, David Giffin wrote: > > > > Hello, > > > > I added in a function to provide server side sorting on searches. This is > > a LDAP version 3 specific function, and uses the Netscape API so I have > > ifdef'ed the new function. It adds a "sortstr" attriubte to the > > ldap_search() function that already exists in php. There might be a better > > way to incorporate the code into php, but here is my first attempt. > > > > proto int ldap_sort_search(int link, string base_dn, string filter > > [, array attrs [, string sortstr [, int attrsonly [, int sizelimit > > [, int timelimit [, int deref]]]]]) > > First of all, in order to be backwards compatible, the argument must be > added to the end. I'm a bit worried that the search function is > getting rather complicated. > > Sorting could be done using ldap_set_option() which we already got, the > problem is that the argument has a complicated structure. It's BER > encoded sequence of sequence. ldap_set_option() could perhaps be made > to take array a value and do BER encoding etc. but that's complicated. > > The solution I prefer I think, is to mirror the Netscape API and do > something like > ldap_create_sort_control(ldap, sortkeylist, 1, &sortctrl); > > How about > > proto int ldap_server_sort(int link, array attrs, int > reverse) > > All subsequent searches should then use this. We could turn it off if > it's called with empty attrs array. When it is on, searches should then > include this control, like you did. > > Maybe my solution sounds ugly, it is more complicated to implement. > I'm just starting to get concerned with all the arguments to ldap_search() > and I think to have it close to the C API if possible. And if you are to > have backwards compatibility, adding it as final argument to ldap_search() > means that users always must supply all the other optional arguments. > > Stig >

« previous php.dev (#55501) next »