Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use generated primary keys ?
Message
De
09/05/2000 10:37:34
Walter Meester
HoogkarspelPays-Bas
 
 
À
09/05/2000 10:12:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00367063
Message ID:
00367648
Vues:
69
Sylvain,
>
>Just a note on that problem 3: I don't see the point of having a PK on start + end, since such a PK would not prevent this:
>
>
Start   End
>   0     10
>   5     16
>   5     17
>  11     20
>  21     30
>
>You have to code the logic to prevent this in the first place, and the code that will prevent this will therefore prevent the uniqueness error.

Welcome in the world of problems that fall out of the scope of the RM.

The problem is that if you draw an ER diagram there is a one to many relation between vacationhours and persons. You might want to apply RI rules to force that everyone fals in one vacationhours category. In other situations you might want to delete child records when a parent record is deleted.

Conclusion is that this looks a lot like a normal relationship between two tables. The difference is that the foreign key value must fall in range of start and end. Therefore you can consider the range itself as PK. This feature is not supported by the RM, so you're forced to write your RI rules (which is no problem in VFP as normal RI rules are also handled as triggers).

In VFP, the PK (range) should be implemented with triggers or validation rules. But this does not change the fact that the range itself is the PK. Here the problem is that the PK is build out of two intelligent values. When the start or end changes, the PK changes (and thus should be handled by RI rules).

The problem here is you can't use generated PKs as a substitude for PKs that are build out of ranges.

Walter,
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform