| Extracted from Pike v7.8 release 866 at 2018-07-18.

[Top]
Protocols
Protocols.LDAP
Protocols.LDAP.client
Protocols.LDAP.client()->result

# Method Protocols.LDAP.client()->result()->fetch()

Method fetch

  `ResultEntry fetch(int|void idx)`

Description

  Returns the current entry pointed to by the cursor.

Parameter `index`

  This optional argument can be used for direct access to an entry other than the one currently pointed to by the cursor.

Returns

  The return value is a mapping describing the entry:

  `attribute : string`

  An attribute in the entry. The value is an array containing the returned attribute value(s) on string form, or a single string if Protocols.LDAP.SEARCH_MULTIVAL_ARRAYS_ONLY was given to search and the attribute is typed as single valued.

  If Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS was given to search then Locale.Charset.DecodeError objects are returned in place of a string whenever an attribute value fails to be decoded.

  `"dn" : string` | This special entry contains the object name of the entry as a distinguished name. This might also be a Locale.Charset.DecodeError if Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS was given to search .

  Zero is returned if the cursor is outside the valid range of entries.

Throws

  Unless Protocols.LDAP.SEARCH_RETURN_DECODE_ERRORS was given to search , a Locale.Charset.DecodeError is thrown if there is an error decoding the DN or any attribute value.

Note

  It's undefined whether or not destructive operations on the returned mapping will affect future fetch calls for the same entry.

Note

  In Pike 7.6 and earlier, the special `"dn"` entry was incorrectly returned in UTF-8 encoded form for LDAPv3 connections.

See also

  fetch_all