Mike Yearwood
Toronto, Ontario, Canada
Information générale
Catégorie:
Codage, syntaxe et commandes
Hi Simon
What will the unique index do for you?
>I rarely use a Unique index but I found a situation where it would be very useful that is what prompted the whole search for the Unique() function.
>
>Thanks
>Simon
>
>>Simon,
>>
>>FYI, here's what Hacker's Guide for VFP7 has to say:
>>--------- start-------------
>>lIsUnique = UNIQUE( [ [ cIndexName, ] nIndexNumber
>> [, nWorkArea | cAlias ] ] )
>>
>>This function tells you whether the index was created with an Xbase unique index. This is not the same at all as the ADD UNIQUE clause of ALTER TABLE or the UNIQUE keyword of CREATE TABLE. Unique indexes in Xbase are a disaster waiting to happen, and we recommend you run like the wind from them. (For details, see INDEX.)
>>
>>UNIQUE() returns .T. if the specified index was created with the UNIQUE keyword of INDEX or with SET UNIQUE ON. If nIndexNumber is omitted, UNIQUE() tells you about the master index.
>>
>>Example
>> USE Customer ORDER Company_Na
>>? UNIQUE() && Returns .F.
>>? UNIQUE(2) && Returns .F.
>>-----------end--------------
>>
>>>Hi Jim
>>>
>>>I searched all through the help looking for the solution. I found the Unique() function but it had no explanation about how to use it. All it said was included for compatibility with dBase.
>>>
>>>I have since discovered the ATagInfo() function but strangely there were no links to this function from the help on "Index" or on "Set unique" so I never came across it.
>>>
>>>So thanks for the information. It appears that I did not search as well as I thought.
>>>
>>>Thanks
>>>Simon
>>>
>>>>Simon,
>>>>
>>>>Do the UNIQUE(), PRIMARY(), CANDIDATE() etc functions not do what you want?
>>>>
>>>>UNIQUE() is not properly documented in the VFP7 Help, but Hacker's has a write-up on it that is useful.
>>>>
>>>>cheers
>>>>
>>>>
>>>>>Hi
>>>>>
>>>>>I ran into a problem where I needed to know if an index was created using the Unique clause. However, I could not find any function that would return this info.
>>>>>
>>>>>Other than routing the Display Status to a text file and searching the results does anyone know how to determine this programmatically?
>>>>>
>>>>>Ideally it would be good to have a function that returned the index type (ie. Primary, Candidate, Unique).
>>>>>
>>>>>Thanks
>>>>>Simon
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement