Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very complicated index expression
Message
De
16/01/2002 12:30:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00605398
Message ID:
00605484
Vues:
18
>>>>>>> Also here is another potential problem, if index expression becomes longer than 255 chars...
>>>>>>
>>>>>>More exactly, longer than 240 bytes.
>>>>>
>>>>>Hi Alexander,
>>>>>
>>>>>Thanks for your response. Actually I meant not the result of the indexing (it would be 29 chars in my case), but the index expression itself. However, I've tried this new expression right now and it worked just fine. It surely looks complex :)
>>>>>
>>>>>
>>>>>index on ;
>>>>>town+UPPER(PADR(TRIM(IIF(AT("=",OWNER1,2)>0,SUBSTR(OWNER1, ;
>>>>>AT("=",OWNER1)+1,AT("=",OWNER1,2)-AT("=",OWNER1)-1),SUBSTR(OWNER1,AT("=",OWNER1)+1)))+ ;
>>>>>IIF(AT("=",OWNER1)>0,LEFT(OWNER1,AT("=",OWNER1)-1),""),25)) tag name1
>>>>>
>>>>
>>>>It wouldn't be a problem to use getfname(), getlname() etc UDF or this complex expressions if you're sure this schema doesn't get you into trouble :
>>>>
>>>>owner1 = "sammy b=iron"
>>>>owner1 = "ammy b=irons"
>>>>
>>>>Names are fictitious of course but I don't know a combination might exist or not in US names. Keeping the separators sounds to be a better idea to me.
>>>>Cetin
>>>So, you're suggesting to add a space between last name and first name and probably use padr(26) then. That's a good suggestion, thanks. Other than that, I think, this complicated expression is better, than UDFs anyway
>>
>>Might not be. With your udf expression might look like :
>>
>>town+GetLName(namefield)+' '+GetFName(namefield)
>>
>>When you're doing a search or SQL to optimize you'd need an expression to match one existing index. This one would be easier or even I would completely make this a new UDF.
>>Cetin
>
>Hi Cetin,
>
>I have this function:
>*!******************************************************************************
>function GetFLNameWithComma
>*  Description.......: Function returns LastName, First name + Initial
>*  Calling Samples...: GetFLNameWithComma(buyer1)
>*  Parameter List....: tcName
>*  Created by........: Nadya Nosonovsky 08/22/2000 05:10:15 PM
>********************************************************************
>lparameter tcName
>local lcFName, lcLName, lnPosEqual1, lnPosEqual2, lcFullName
>lcLName=alltrim(m.tcName)
>lnPosEqual1=at('=',m.lcLName)
>lnPosEqual2=at('=',m.lcLName,2)
>lcFName=""
>if m.lnPosEqual1>0
>	lcFName=left(m.lcLName,m.lnPosEqual1-1)
>	lcLName=substr(m.lcLName,m.lnPosEqual1+1,;
>		iif(m.lnPosEqual2>0,m.lnPosEqual2-m.lnPosEqual1-1,25))
>endif
>lcFullName=m.lcLName+iif(!empty(m.lcFName),', ','')+m.lcFName
>return m.lcFullName
>
>If I put index on town+padr(GetFLNameWithComma(owner1),26) tag name1 it would mean, what we can use our tables only inside the application or with path set properly to the storage of this function...
>
>Anyway, what in your opinion is better: this UDF or the long complicated expression? (BTW, I already updated our IndxDict with this long expression for all "name" kind of indexes).

Nadya,
Stored procedures move with thair databases.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform