Subject | RE: Helen [IBO] Foreign Key |
---|---|
Author | Helen Borrie |
Post date | 2001-04-03T13:18:02Z |
At 02:46 PM 03-04-01 +0200, you wrote:
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Sorry Helen, I didn't see the mail, thanks a lot, but one more questionYes. You might also consider adding triggers or CHECK constraints to the columns in the tables using those lookups, too, to ensure that the value entered does exist in the control table. (You might consider this unnecessary, though, if you are using DBLookupCombos for them at data entry time).
>then. The main reason I was planning to use foreign keys was to be sure
>that the data entered was correct. For example payment conditions. With
>that foreign key I would be sure that when I enter the payment condition in
>the customers table, that the value entered would reference the primary key
>in the payment conditions table. And when a user would attempt to delete a
>record in the payment conditions table, that is used in the customers table,
>he will receive a error.
>Now I accomplish all of this in triggers. Before there is a record entered
>in the customers table, I have a pre-insert trigger that checks if the
>payment condition is valid, and for the payment conditions table, I have a
>before delete trigger with a IF (EXISTS.... statement to check if that
>condition is used in the customers table. Is that a good thing then ?
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________