[PHP] Re: [PHP-DEV] ldap_search sort extension, patch included From: Andre Oppermann (oppermann <email protected>)
Date: 11/18/01

Stig Venaas wrote:
>
> On Sun, Nov 18, 2001 at 01:27:18PM +0100, Andre Oppermann wrote:
> > Stig Venaas wrote:
> > >
> > > On Sat, Nov 17, 2001 at 11:22:21PM +0100, Andre Oppermann wrote:
> > > > Stig Venaas wrote:
> >
> > Defining a PHP callback funtion is probably too complex. But having
> > different options for sort algorithms would useful:
> >
> > LDAP_SORT_ASCII, strncasecmp, default
> > LDAP_SORT_ASCII_CASE, strcmp
> > LDAP_SORT_UTF8, ???
> > LDAP_SORT_UNICODE, ???
> > ...
> >
> > The function would look like this:
> >
> > (PHP_)ldap_search($ld, $res, "c, city", LDAP_SORT_ASCII);
>
> Right (except that I want it to be (PHP_)ldap_sort (maybe
> (PHP_)ldap_sort_entries). Think I'll implement it without that last

Ugh... I meant ldap_sort of course. I'm always automagically writing
it wrong... :(

> parameter, at least at first. I still think callback could be useful,
> but that's also we can add later if necessary. Have you seen
> ldap_sort_entries() implementations that allow multiple attributes? I
> haven't seen that yet. I also see that at least OpenLDAP and Netscape
> allow sorting on DN if attribute is NULL, I guess we could let empty
> string do that.

You can specify many attributes to sort for. Simply put them into a
comma separated list.

> > > > Until now the right thing to do (see ldapsearch tool in OpenLDAP/UMICH)
> > > > to do this:
> > > >
> > > > ldap_search($ld,...);
> > > > ldap_sort($ld, $res, $sortlist, [OPT_UNICODE | WHATEVER]);
> > >
> > > What I wrote with ldap_sort() and ldap_search() was PHP code. I suggest
> >
> > I wrote PHP code as well ;)
>
> Oops, too early in the morning. I'll try to implement it this way, it's
> the best PHP API I think (except that I drop the 4th parameter, at least
> for now).

Ok.

-- 
Andre

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>