Re: ldap_search sort extension, patch included
| From: | Stig Venaas | Date: | Sun, 18 Nov 2001 13:05:27 +0000 |
| Subject: | Re: ldap_search sort extension, patch included | ||
| References: | 1 2 3 4 5 | Groups: | php.dev php.general |
| Request: | Send a blank email to php-general+get-75035@lists.php.net to get a copy of this message | ||
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
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.
> > > 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).
Stig