Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Composite primary keys
Message
From
03/12/2004 08:40:37
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
03/12/2004 04:56:21
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00966059
Message ID:
00966654
Views:
7
>Thank you Mark, it worked. The problem was certainly that as long as the database was part of an open project, it would not close even when issuing the CLOSE DATABASES command.

You can select the database in the project, and select "Close". IOW, you are not forced to close the project, just to close the database.

>Ouch ! The Ignore / Restrict / Cascade choice has to be made for every database relation ! This has been painful.

The most common case is RRR. This covers most cases; you could put everything as RRR, and do minor changes later, as you see the need for it.

Two exceptions are:

1) If a field is optional in the child table, use RRI. For example, parent = client; child = invoice. If every invoice has to have a valid client, use RRR. If some invoiced might not have a corresponding client ("over the counter sales"), use RRI (i.e., "ignore" in the third part). Of course, with TaxRI, you could also use "Allow blank", instead.

In a self-relation, for example, in an employee table "A" is the boss of "B", there will always be a person who doesn't have a boss, so you can't use a strict (RRR) relation here. Similar with the account definitions, in an accounting system.

2) In some cases, it is useful to use cascading delete; this can save you some code when deleting data. An example is that when you delete an invoice, all invoice details, which are of course in a separate table, will also be deleted. (Suggestion: because of the amount of data that is potentially deleted, give the users warnings that are stronger than the usual ones.)
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform