home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!spool.mu.edu!agate!dog.ee.lbl.gov!news!humu!pegasus!tleylan
- From: tleylan@pegasus.com (Tom Leylan)
- Subject: Re: Clipper...Set Unique On/Off
- Message-ID: <1992Dec18.193940.17477@pegasus.com>
- Organization: Pegasus, Honolulu
- References: <18587@mindlink.bc.ca>
- Date: Fri, 18 Dec 92 19:39:40 GMT
- Lines: 36
-
- John_Carson@mindlink.bc.ca (John Carson) writes:
-
- >It has come to my attention on a client program that SET UNIQUE ON/OFF can be
- >the start of corrupted index files. I assume that if you SET UNIQUE once with
- >the database you must all the time.
-
- John: Are you using Clipper S'87 or 5.0 ? With 5.0 I believe you will find
- the "unique" status is maintained within the index (it is imbedded in the
- index and it knows) therefore once created it will always be unique type.
-
- You should avoid the SET UNIQUE altogether (you're stuck in S'87) and use
- the UNIQUE clause when indexing, environment changing stuff like SET
- commands should be avoided whenever practical and possible.
-
- Unique indexing is not (from the sound of the last part of your message)
- a method of preventing duplicate records. The data is stored in the .DBF
- but an entry is not made in the index if there is one already. It is
- mostly used for reports (or possibly querying) but not common.
-
- Here is why:
-
- append "smith" // smith in dbf and ntx
- append "smith" // a second smith in dbf but not in ntx
- goto top // get to first smith
- delete // at this point there is no smith record in
- // the index as nothing causes the index to
- // go looking around for more "smith"'s
-
- If you want to prevent duplicates (by index key) then you enter the data
- into variables (I hope you don't enter into fields directly) SEEK on the
- key and if there are no hits append a blank and replace and if there is
- a hit, warn the user and have them edit the key again.
-
- tom
-
-
-