swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
      Other Library Functions  
function  

ldap.search

 
 

Library: Interfaces, LDAP support (OMLDAP)
Import: omldap.xmd

Declaration

  define external function ldap.search
               value      ldap.connection connection
       base    value      stream          base
       scope   value      integer         scope      optional
       where   value      stream          filter
       into    modifiable ldap.attribute  result
       format  value      integer         format     optional
       selects read-only  stream          attributes

  or

    define external function ldap.search
               value      ldap.connection connection
       base    value      stream          base
       scope   value      integer         scope      optional
       where   value      stream          filter
       into    modifiable ldap.attribute  result
       format  value      integer         format     optional
       select  remainder  stream          attribute
         and ...
  Where:

Argument definitions

connection
A connection to an LDAP server.
base
The root value for the start of the search.
scope
A parameter that specifies how deep in the tree you want to search. The default is ldap.scope-onelevel. The other possible parameters are ldap.scope-base and ldap.scope-subtree.
filter
The search filter for this scope.
result
The set of attributes which satisfy the search condition.
format
The format of the search result. ldap.format-value is the default; the other value is ldap.format-value-type.
attributes
A shelf of attribute names whose values you want returned. This is an alternative to specifying each name individually.
attribute
A list of attribute names whose values you want returned (separated by the word "and" if there is more than one). This is an alternative to specifying a shelf of attribute names.


Purpose

The ldap.search function executes a search on the LDAP server specified by ldap.connection.

The following example searches one level deep from the base of "stilo.com" for the name, employee number, and telephone number of all employees in the R&D department.

The ldap.attribute shelf contains the selected attributes from the first entry that satisifed the search, keyed by the attribute name.

ldap.advance-entry advances to the next entry satisfying the search. ldap.entry-exists returns false when there are no more entries.

  import "omldap.xmd" prefixed by ldap.

  process
     local ldap.connection my-ldap
     local ldap.attribute my-entry variable

     set my-ldap to ldap.open 'www.stilo.com'
     ldap.search my-ldap
        base  "o=stilo.com"
        scope ldap.scope-onelevel
        where  "(Department=rd)"
        into   my-entry
        select "name" and "employeenumber" and "phonenumber"

     repeat
        exit unless ldap.entry-exists my-entry
        output ldap.entry-name of my-entry
            || "%n  Name:   "
            || ldap.reader of my-entry{"name"}
            || "%n  Number: "
            || ldap.reader of my-entry{"employeenumber"}
            || "%n  Phone:  "
            || ldap.reader of my-entry{"phonenumber"}
            || "%n"
        again
        ldap.advance-entry my-entry
     again

        Other Library Functions
   ldap.add-entry
   ldap.advance-entry
   ldap.attribute
   ldap.close
   ldap.connection
   ldap.create-attribute
   ldap.delete-entry
   ldap.entry-exists
   ldap.entry-name
   ldap.modify-entry
   ldap.name
   ldap.omldap-version
   ldap.open
   ldap.reader
   ldap.rename-entry
   ldap.retrieve-values
   ldap.search
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:26 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.