[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] re: problems
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] re: problems |
Date: |
Sat, 22 Nov 2003 15:27:59 +0100 |
User-agent: |
Mutt/1.3.22.1i |
Oh, the woes and powers of improper naming ! We got into this
quagmire when someone assumed that since there is a
getActiveName() there ought to be a setActiveName(), too. This
is all nice and well with certain branches of programming
theory but it doesn't make sense in the business object API.
The name is simply ambigous. Is it supposed to be
activate_name() or add_name_and_activate() ? (My UPDATE on a
names row violated our business agreement anyways as we don't
change name records, only deprecate them.) Hence we shall
decide to deprecate setActiveName in favour of addName().
Upon which clarification we find out that we can add a flag
argument "activate" without introducing any more ambiguity.
addName() internally SELECTs add_name() which is a stored
procedure trying to take care of some issues such as the name
to be added already existing for this person. It, too, handles
the activate flag.
So, the sequence to make a new patient turns into the
following now:
1 new_id = create_dummy_identity()
2 new_person = gmPerson(new_id)
3 new_demos = new_person.get_demographic_record()
4 new_demos.addName(first, last, activate)
Yes, I know, the step from 1 to 2 isn't entirely clean
conceptually either as I pointed out previously that the entity
for which new_id is a handle isn't a person. If we want to be
strict we'd have to add another module level call
turn_dummy_identity_into_person(firstname, lastname, dob). I
shall leave it at that until someone clamors for that level of
conceptual purity.
Please report further breakage and bugs. This now is more
productive than previously.
What produced the strange update title behaviour is this, I
believe:
setTitle UPDATEs names
it does NOT provide a value for names.active
the SQL engine sets NEW.active to TRUE as that is the default
the update/insert trigger fires on names
it finds that NEW.active is true (as per default) and goes about its business
Not entirely sure, though.
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346