Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best and fastest way for making a cursor
Message
De
23/06/2007 11:06:31
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
22/06/2007 16:03:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP1
Divers
Thread ID:
01234669
Message ID:
01235176
Vues:
18
>>>>>>FIND THE RIGHT WAY TO DO STUFF AND ONLY DO IT! :)
>>>>>
>>>>>All right, All right, All Right! :)
>>>>>
>>>>>However, note that in this case we are talking about
>>>>>create cursor command and resulting memory cursor. Reusing it again with different alias is not likely an option. As soon as you close it; poof ... it is out of picture (memory) for good.
>>>>>
>>>>>Is this what you presented here only 'damage' that can happen or it can also
>>>>>burn toaster in adjacent room ?? :))
>>>>>Just kiddin' , but now real question;
>>>>>
>>>>>Is there any damage that can be caused to index key itself if field name is
>>>>>included when creating it? I belive that index created on a temp cursor this way is still healty;
>>>>>or I am mistaken ?
>>>>
>>>>I don't think there is *anything* "healthy" about indexes built with included aliases. The fact that you'd have one in one case, but not in other cases is very very bad. Too many programmers IMO are not thinking about the advantages of "fewer" construction technique. Things should be done the same way everytime so it becomes second nature. Deviating from that standard approach should be done only after exacting analysis.
>>>>
>>>>The only way I'd ever include the alias is if I built an index across two related tables. Of course I don't advise that either. Very rare :) I'd use SQL and produce a single cursor in that case.
>>>
>>>Leave aside coding practices;
>>>Is there anything wrong with index file created this way in terms of functionality ?
>>
>>The real question MUST be "Is there anything GOOD about doing that?" Just because you can do it means nothing in terms of quality, safety etc.
>>
>>I cannot help you justify doing something I don't approve of. Smoking is wrong, but you can do it if you want. Crossing the street illegally is wrong, but just because you have "never" been hit by a car does not mean it is safe. Better safe than sorry.
>>
>>I showed a few simple examples where it was problematic or even impossible to use aliases in index expressions. Those are reasons enough for me to avoid that practice and to recommend others avoid it too.
>>
>>HTH
>
>Okay Mike.
>You prooved your point very well in first response, so no need
>waisting energy on the second of the same nature.
>I did not ask for justification, just asked plain question;
>Not in order to proove any point (or justify practice) but out of plain
>curiosity. Aparently you took it more serious then I would anticipate.
>
>I agree that certrain rules should be folowed by all means, but we all know
>that there are exceptions to meny rules. I was just trying find out if this is one of those situations, or it is really something serious enough to bear in mind next time I am about to create memory cursor.
>Only thing I would consider serious here if index file gets corrupted
>otherwise I can't see much harm in it, beside violating rule established
>to prevent some other harm.
>
>If harm does not happen, does rule still apply ?

Absolutely. Why use a risky technique? You might trip over it later. Then you'll have to spend time trying to understand what went wrong. They you'll have to spend time to fix it by doing what should have been done in the first place? Furthermore, how much changing will it require to remove every place you've done this "trick"?

I love to show clients discussions like this.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform