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

Re: Add-if-not-present

Ludovic Poitou wrote:
Are you really trying to achieve a MOD_ADD_IF_NOT_PRESENT or don't fail
adding an attribute or value if the value is already present ?

on the attributes and values, so that adding an attribute that exist will
succeed but do nothing and similarly deleting an attribute or value that is
not present succeed.

Funny you should mention that. We support this control as well. I didn't get the impression that that was the goal here. It sounded to me like "add this value unless *any* value is present" not "add this value if *this value* is not present"...

My 2 cents.


On May 26, 2010, at 3:53 PM, masarati@aero.polimi.it wrote:

I need to implement a modify operation whose semantics is "add if not
present", an add that only takes place if that attribute is not yet
present in the entry.

I need it as an internal operation, so right now I wouldn't bother
formalizing it as an extension of the semantics of the modify operation.
Something like the SLAP_MOD_SOFTADD, which in turn consists in adding an
attribute value only if that value is not already present.

I'd introduce a SLAP_MOD_ADD_IF_NOT_PRESENT flag and add code to support
it in all (well, most) backends/overlays that need to muck with modify
operation type.

Comments?  Objections?  p.

It might be a good idea to have a SOFTDEL as well; both are useful for
declarative modifications of data.  Think of them in terms of:

Soft Add: The attribute shall contain at least these values, but might
have others
Soft Del: The attribute shall contain none of these values, but might have

Ideally as modify sub-operations.

I'm not sure I understand how SOFTDEL differs from LDAP_MOD_DELETE.  Do
you mean that values listed in SOFTDEL will be deleted if they exist, or
otherwise ignored?


Ludovic Poitou                                    Sun Microsystems Inc.
OpenDS Community Manager            Directory Services
http://blogs.sun.com/Ludo/         Grenoble Engineering Center - France

OpenDS, the Java LDAP Directory Server

  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/