On Mon, Nov 12, 2001 at 11:29:48PM -0800, Jeremy Zawodny wrote:
> On Mon, Nov 12, 2001 at 10:52:39PM -0800, Bennett Haselton wrote:
> > Say I have two running programs and both of them periodically want to
> > increment a value in a database. How can I do this so that the increments
> > will be
The solution is fairly easy.
In you update statement you place something like this :
update table
set valuefield = newvalue
where keyfield = key
and valuefield = oldvalue
after the update you check affected rows.
if affected rows = 0 then it means that somebody else already changed the
valuefiel
On Mon, Nov 12, 2001 at 10:52:39PM -0800, Bennett Haselton wrote:
> Say I have two running programs and both of them periodically want to
> increment a value in a database. How can I do this so that the increments
> will be performed correctly even if the two programs try to do them at the
> s