Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding Indexes
Message
De
06/08/2009 15:59:20
 
 
À
06/08/2009 15:42:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01416559
Message ID:
01416569
Vues:
51
From http://fox.wikis.com/wc.dll?Wiki~VFPMisusedAndAbused~VFP:

INDEX...UNIQUE should not be used to enforce uniqueness of a value as that is not what it does.
INDEX...UNIQUE causes the index to only reflect one instance of each unique value of the index expression in the table. For example, one might use INDEX...UNIQUE to obtain a non-duplicated list of states from an Address table.

The "unique" index has some insurmountable problems. It cannot be depended on to be maintained dynamically. Because Fox only updates an index related to the record being altered, certain conditions can cause a Unique index to become incorrect. For example, a unique index on state will reflect one record for each state. In a table there may be 100 records for the state of NY, if you delete the one reflected in the unique index VFP will update the index by removing the reference to NY for that record, however since only the altered record is considered in the update of the index there will now be no reference for the state of NY in the index even though there are 99 records in the table for that state. (This situation can get even worse).


>I'm reasonably clear on how VFP uses indexes to prevent duplicate data entry but found out that it apparently applies such index controls to deleted records. Is there a way to set up VFP indexes to bypass or ignore deleted records? All responses are appreciated.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform