#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    1
    Rep Power
    0

    LDAP Query to retreive Max ID


    Hello All,
    I have an ou Company which has attribute company id (sequential number). Is there any way to do query LDAP to find out max id.

    Thanks in advance for your help.

    Zun
  2. #2
  3. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    I could be wrong but I don't think there is within LDAP. For something like this the best way would be to loop though all the records and get the max from it. Of course if you have a ton of entries this is in effienct and for that I'd recomend just having a attribute in the top level directory with the max in it and everytime you add a new entry just increment it by 1.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Location
    Stuttgart
    Posts
    50
    Rep Power
    11
    According to Viper_SB there is none. The only way to get the max. value ist to use a 3rd party programming language (PHP, perl, C etc...).

    The LDAP search filter are defined in RFC 2254; the basic useable operators are these:


    4. String Search Filter Definition

    The string representation of an LDAP search filter is defined by the
    following grammar, following the ABNF notation defined in [5]. The
    filter format uses a prefix notation.

    filter = "(" filtercomp ")"
    filtercomp = and / or / not / item
    and = "&" filterlist
    or = "|" filterlist
    not = "!" filter
    filterlist = 1*filter
    item = simple / present / substring / extensible
    simple = attr filtertype value
    filtertype = equal / approx / greater / less
    equal = "="
    approx = "~="
    greater = ">="
    less = "<="
    extensible = attr [":dn"] [":" matchingrule] ":=" value
    / [":dn"] ":" matchingrule ":=" value
    present = attr "=*"
    substring = attr "=" [initial] any [final]
    initial = value
    any = "*" *(value "*")
    final = value
    attr = AttributeDescription from Section 4.1.5 of [1]
    matchingrule = MatchingRuleId from Section 4.1.9 of [1]
    value = AttributeValue from Section 4.1.6 of [1]

IMN logo majestic logo threadwatch logo seochat tools logo