Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use generated primary keys ?
Message
De
07/05/2000 12:27:54
 
 
À
07/05/2000 10:43:56
Walter Meester
HoogkarspelPays-Bas
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:
00367089
Vues:
32
Walter, Jim,

PMFJI, but I see the deleted record of VFP as a powerful feature, not a weakness. I don't know of any non xbase database where you can RECALL a deleted record, and while I admit I rarely use that feature, I did in the past and it worked perfectly. In Access they're there - Access just never shows them to protect the user from himself. VFP gives us choice, and that is something I love about it! SQLServer probably does the same thing, however it's easy for SQL (or Oracle) to pack it's table as soon as a record is deleted because even though there might be thousands of simultaneous users, there is only one program actually accessing the physical file.

Ok, so it raises the issue of the primary keys... Small problem, in my opinion. But the problem is easilly justified: what if you recall a record who's PK has been re-used? Now you have to solve that conflict before recalling.

I once worked on a project where we did not use surrogate keys. Table1 had a single field as it's PK. It's child had 2: the PK from Table1 + another field in Table2. Table3 now had to have 3 fields for it's PK: the 2 fields of Table2 + another field, and so on. We had tables with as much as 5 fields for it's PK.

Do you agree, Walter, that this last table should have a surrogate key? I think it should. As such, I think it's logical and consistent to have surrogate keys for all tables.

As for enforcing the uniqueness of an index, we used to do that in FoxPro 2.6 which didn't have any business rules. Since you're using the VFP tables, a simple SEEK() or INDEXSEEK() will tell you if that value is already used, without concerning itself with deleted records.

And BTW, about your comment of someone coming from the SQLServer world into VFP, finding us crazy to have to work around deleted records, I had the opposite feeling when I first played with Access. "Ok, now how do I recall a deleted record? What?!!?! You mean you can't?"

Just my 2 cents!



>>>This seems an odd step to me. In the logical data design, it is defined as a primary key.
>>>- In the physical datadesign it isn't even an alternate key ?
>>>- Then, How do you enforce the uniqueness of the articleno field ?
>>>- How would you define this in another (R)DBMS, where the existance of deleted() records do not exist.
Sylvain Demers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform