On Sat, 3 Aug 2002, Sander Steffann wrote:
> I have this problem in a few real-life cases, so if you have a sollution to
> this, I would realy appreciate it!
Add a card_type column to your main table, and insert something
indicating the value of the card type there.
That won't stop you from having entries for the card in both
network_card and sound_card, but one of those entries will be
meaningless extra data.
Of course, this also means you have to go back to the relational
model to select all your network cards. Doing
SELECT * FROM network_card
may also return (incorrectly inserted) non-network cards, if your
data are not clean, but
SELECT card.card_id, card.whatever, network_card.* FROM card, network_card WHERE card.card_id =
network_card.card_idANDcard.type = 'N'
is guaranteed to return correct results. And of course you can just
make that a view called network_card, and the same statement as
you used with the inerhited table will work.
Oops, did I just replace your "object-oriented" system with a
relational one that does everything just as easily, and even does
something the object-oriented one can't do? Sorry about that. :-)
cjs
--
Curt Sampson <cjs@cynic.net> +81 90 7737 2974 http://www.netbsd.org Don't you know, in this new Dark Age, we're
alllight. --XTC