Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [jdgamble] Creating Table with Foreign Key

Quote Reply
Re: [jdgamble] Creating Table with Foreign Key In reply to
Quote:
1. If I delete a record, its foreign key record should delete automatically from the original primary key.

the foreign keys work with deletions, yes. For example, if you delete a record from Links, then all records in any other table which has a matching foreign key on Links.ID (ie, the Bookmark table) will be deleted as well.

Quote:
2. I should not be able to add a record to the relationship table that does not have a corresponding primary key to its foreign key.

If memory serves, insert() and add() do not check this. It's up to you to make sure the relationship is valid prior to inserting the record.

Philip
------------------
Limecat is not pleased.
Subject Author Views Date
Thread Creating Table with Foreign Key slg_saravanan 3684 Sep 7, 2006, 12:09 AM
Post Re: [slg_saravanan] Creating Table with Foreign Key
fuzzy logic 3601 Sep 7, 2006, 6:35 PM
Thread Re: [slg_saravanan] Creating Table with Foreign Key
brewt 3590 Sep 7, 2006, 10:32 PM
Thread Re: [brewt] Creating Table with Foreign Key
jdgamble 3544 Sep 8, 2006, 2:13 PM
Thread Re: [jdgamble] Creating Table with Foreign Key
fuzzy logic 3541 Sep 8, 2006, 3:48 PM
Thread Re: [fuzzy logic] Creating Table with Foreign Key
jdgamble 3542 Sep 8, 2006, 8:18 PM
Thread Re: [jdgamble] Creating Table with Foreign Key
fuzzy logic 3519 Sep 8, 2006, 8:56 PM
Post Re: [fuzzy logic] Creating Table with Foreign Key
jdgamble 3536 Sep 8, 2006, 9:08 PM