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

Re: How can I lock a record using php-ldap?



man, 2003-01-27 kl. 10:39 skrev Thomas Heil:

> There are possibilities with php-ldap too. Why cant nobody give some advices
> ?

What is php-ldap?

The PHP 4.3.0 ldap docs are no different (AFAICS) from the 4.2.3 docs
(though not very enlightening). under ldap_mod_replace:
_______________________

ldap_mod_replace
(PHP 3>= 3.0.8, PHP 4 )

ldap_mod_replace -- Replace attribute values with new ones
Description
bool ldap_mod_replace ( resource link_identifier, string dn, array
entry)

Returns TRUE on success or FALSE on failure.

This function replaces attribute(s) from the specified dn. It performs
the modification at the attribute level as opposed to the object level.
Object-level modifications are done by the ldap_modify() function. 
________________________

I'm not a database programmer, but the Sleepycat html docs included with
the BDB 4.x source install packs give invaluable info to ordinary
sysadmins. I have BDB 4.1.24 installed with Openldap 2.1.10, so the
following applies to those libraries, not gdbm.

In the docs, the Berkeley libraries are described as allowing atomic,
all or nothing, updates. ldap_mod_replace (as opposed to ldap_mod_add
and ldap_mod_del) would seem to satisfy the needs for that. The
Sleepycat docs also state that locking is carried out if the database
application using the BDB libraries supports it. Perhaps Howard could
comment on that aspect.

There would be no race condition, since an attribute being modified
would simply not be available. If the value previous to the update were
cached, and an other application wanted to make use of it after the
actual update had freed any locks, it wouldn't exist any longer.

This, coupled with Howard's assurance, posted recently on this
list,would indicate that this is the way to go - at least, as far as PHP
is concerned. There should be no difference for C-based applications,
either, with LDAPMod - though I'm not a C programmer, either.

Best,

Tony

-- 

Tony Earnshaw

When all's said and done ...
there's nothing left to say or do.

e-post:		tonni@billy.demon.nl
www:		http://www.billy.demon.nl