> From: Paul Holm
> Update x.y  set name = 'Frank' where keyField = 9 and lockfield1 =
> value1' and lockfield2 = 'old value2'

If you're going to do this, please include the code that checks for lack
of update.  I assume there is some magic field in the SQL return data
that indicates the number of records updated; if that value is zero,
then perform the "record was updated by someone else" logic.

This also gets really cumbersome when there are lots of fields to check.

> b.  Using a counter or timestamp loses this level of control.  An
> unimportant field change could through out a pending change when
really it
> shouldn't have to.

If you have dissociated field groups (whether or not such a database
design is valid is a different discussion for a different day), simply
add one counter for each field group.  If you have data that can be
overwritten, only update the counter if an "important" field is updated.

> In addition, most databases don't have this counter or
> timestamp and folks are resistant to adding a new field to all files
> this purpose.

This is not a good reason, especially if you have encapsulated your
updates in a single place.  It only gets to be problematic when you have
database updates littered throughout your application, which is poor
architecture in the first place.


Return to Archive home page | Return to MIDRANGE.COM home page