[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: ldap_get_values() VS ldap_first_attribute()



This question is probably more appropriate for the openldap-software mailing
list. The -devel list is reserved for development of the actual OpenLDAP
code.

To answer your question, yes, you can skip the ldap_xxx_attribute().
Since the ldap_get_values functions use case-insensitive compares, it
makes no difference. The standard LDAP C API has a lot of problems /
inefficiencies, and this is only one of many areas that are less than
reasonable.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support

> -----Original Message-----
> From: owner-openldap-devel@OpenLDAP.org
> [mailto:owner-openldap-devel@OpenLDAP.org]On Behalf Of samuel.osouf
> Sent: Friday, June 07, 2002 4:56 AM
> To: openldap-devel@OpenLDAP.org
> Subject: ldap_get_values() VS ldap_first_attribute()
>
>
> I found this sample code on Netscape's web site :
>
> ##############################################
> "The following section of code gets the first
> value of
> the jpegPhoto attribute and saves the JPEG data to
> a file:
>
> (...)
> /* Find the jpegPhoto attribute. */
> a = ldap_first_attribute( ld, e, &ber );
> while ( strcasecmp( a, "jpegphoto" ) != 0 ) {
> a = ldap_next_attribute( ld, e, ber );
> }
>
> /* Get the value of the attribute. */
> if ( ( list_of_photos =
>      ldap_get_values_len( ld, e, a ) ) != NULL ) {
> /* Prepare to write the JPEG data to a file */
> (...)
> ##############################################
>
> So my question is :
> can't we SKIP the ldap_xxx_attribute() ??  That
> is :
>
> /* Get the value of the attribute. */
> if ( ( list_of_photos = ldap_get_values_len( ld,
> e, "jpegphoto" ) ) != NULL ) {
> /* Prepare to write the JPEG data to a file */
> (...)
> ##############################################
>
> I think the advantage of the 1st code is to allow
> "JPEGphoto", "jpegPhoto", etc.
> But is it the ONLY one ?
>
> Accédez au courrier électronique de La Poste : www.laposte.net ;
> 3615 LAPOSTENET (0,13 ?/mn) ; tél : 08 92 68 13 50 (0,34?/mn)"
>
>