This function performs a search in the LDAP server. It returns control to the Virtuoso/PL environment only after all of the search results have been sent by the server or if the search request is timed out by the server. The result of the search (attributes, names of the attributes, etc.) will be returned as an array result. Options to the LDAP search can be passed as an array.
<filter> ::= '(' <filtercomp> ')' <filtercomp> ::= <and> | <or> | <not> | <simple> <and> ::= '&' <filterlist> <or> ::= '|' <filterlist> <not> ::= '!' <filter> <filterlist> ::= <filter> | <filter> <filterlist> <simple> ::= <attributetype> <filtertype> <attributevalue> <filtertype> ::= '=' | '~=' | '<=' | '>='
This function returns an array consisting of the following elements:
<entry type>, (<attribute name>, (<value 1>, <value 2> ...))
The entry type can be the keyword 'entry' for search entry, 'reference' for search reference, 'extended' for extended result, or 'result' for result from search. When you specify 'result', the returned array consists of 'error' and 'error message' keywords corresponding to error codes and error descriptions.
.... declare result any; -- without authentication result := ldap_search ('ldap://localhost', 0, 'c=US', '(cn=SomeBody*)', NULL); or -- with authentication result := ldap_search ('ldap://localhost', 0, 'c=US', '(cn=SomeBody*)', 'cn=root,o=opl,c=US', 'secret'); -- the result may be following array: -- ("entry" ("dn" "cn="John Atanasov",mail=hellraisor@hotmail.com,c=US,o=hotmail.com" "mail" ("hellraisor@hotmail.com" ) "cn" ("John Atanasov" ) "o" ("hotmail.com" ) "l" ("SOFIA" ) "givenName" ("John" ) "surname" ("Atanasov" )) "result" ("error" "0" "error message" "Success" )) ...