Subject Re: [firebird-support] Re: Bad design causing problems
Author Rik Barker
Hi Dave,

Thanks for taking the time to reply.

>You could look for existing entries in your SP before doing the insert
>and throw an exception if the entry already exists. Or you could
>create a Unique index on Name so the insert of a duplicate would fail.

I think I suggested both of those in my email. The SP certainly already
attempts to look for existing entries. However, I think because the
threads are isolated that Thread2 isn't aware that Thread1 has already
added the record.

It's not a case of not wanting to throw an exception, it's a case of not
(yet) knowing how to throw an exception.

>Er, in the real world names are duplicated. Are you sure you have a
>true model if it rejects duplicates?

<grin> You are not a free man, you are a number. Because there could be a
whole lot of data, I'd rather only have "Bob" in there once, and from then
on refer to Bob as 17312. I have several tables that inter-relate, and I'm
using the ID field as a foreign key in other tables.

Sort of:
Tracks <---- TrackArtists ------> Artists
ID (PK) TrackID ID (PK)
TrackName ArtistID ArtistName

Hope that makes some sense.
Cheers,
Rik