Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Index
Message
De
31/01/2005 09:30:33
 
 
À
31/01/2005 09:16:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Re: Index
Divers
Thread ID:
00982167
Message ID:
00982223
Vues:
35
Jim,

Fair enough


>Gregory --
>
>I have no reason to question your statement (or any statements, for that matter) about the relative speeds of algorithms, as I haven't found any need to be concerned about speed in my applications. I presume that the data I have to work on is of a reasonable enough size and CPUs are fast enough these days that I'm lucky to be able to spend my time implementing solutions without worrying about avoiding small inefficiencies.
>
>Jim
>
>>James,
>>
>>What I wrote (the performancewise bit) is imo the fastest you can get it in vfp, without dlls or flls
>>
>>>Your suggestion using FUNCTION CharBitNot looks good to me, as that's exactly what I do ... although the internals of my function are different:
>>>
>>>
FUNCTION Reversechars(lcChars)
>>>   LOCAL lnI
>>>   FOR lnI=1 TO LEN(lcChars)
>>>      lcChars=STUFF(lcChars,lnI,1,CHR[255-ASC(SUBSTR(lcChars,lnI,1))])
>>>   ENDFOR
>>>   RETURN lcChars
>>>ENDPROC
>>>
>>>
>>>Jim
>>>
>>>
>>>>>Hi All,
>>>>>
>>>>>I would like to know whether is there a way to index a table on 2 coulmns, Both are character fields. The First column has to be descending while the 2nd Column has to be ascending.
>>>>>
>>>>>Any answers,
>>>>>Thanks,
>>>>>JD.
>>>>
>>>>
>>>>As said, everything is possible
>>>>
>>>>
>>>>&& simple solution
>>>>&& use a view
>>>>
>>>>create sql view ViewOnTablexx as ;
>>>>    select ..... ;
>>>>        from Tablexx ;
>>>>        order by Fieldx desc, Fieldy asce
>>>>
>>>>
>>>>
>>>>Another possibility
>>>>
>>>>function CharBitNot(s)
>>>>    return chrtran(m.s, chr(0)+chr(1)+chr(2).....+chr(255), chr(255)+chr(254)....+chr(1)+chr(0))
>>>>endfunc
>>>>
>>>>select Table
>>>>index on CharBitNot(Fieldx) + Fieldy tag pp
>>>>
>>>>&& performancewise it would be best to build the chrtran() arg2 and arg3
>>>>&& in the init of your program, you could
>>>>=_screen.AddProperty(BitNotCharFrom, chr(0)+chr(1)+chr(2).....+chr(255))
>>>>=_screen.AddProperty(BitNotCharTo, chr(255)+chr(254)....+chr(1)+chr(0))
>>>>&& or use a loop to build them
>>>>
>>>>select Table
>>>>index on chrtran(Fieldx, m._screen.BitNotCharFrom, m._screen.BitNotCharTo) + Fieldy tag pp
>>>>
>>>>
>>>>
>>>>There may be other possibilities
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform