Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Making unique cursor name?
Message
De
02/02/2008 13:56:17
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
02/02/2008 12:21:54
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01288050
Message ID:
01288530
Vues:
14
>>Jim,
>>
>>I was always using meaningful names for my cursor (like TEMP_CURS <g>). And I understand that the actual table name on the local drive is unique. But I was thinking, what if the same class gets used at the same time and the application tries to create TEMP_CURS again, where it already exists. Hence, the problem. So I am going to switch to the sys(2015) approach.
>
>Using datasession object will mean that each session can have cursors with the same name without anything interfering with anything else.

Except that at some point you may want to use the same cursor more than once in the same datasession. Typical examples would be entities appearing in roles, like in a dating agency, where we pull two of them and want to have two lookups into the same data. Or in a recursive walk down a self-referencing table - the code which selects records for one branch is the same as for any other branch; the name of the resulting cursor, however, must not be the same, and we surely cannot create a new DS for every branch - and don't need to.

I do like a mixed approach:
lcCursor="crsDates"+sys(2015)
select ... into cursor (lcCursor) ...
This gives me two things I wanted: alias is unique; alias is meaningful. During debugging, I can maybe wonder which of the six crsThisOneIsRight_2AH0TPSBR, crsThisOneIsRight_2AH0TQBFA crsThisOneIsRight_2AH0TQHC9 ... is the one I want, but I won't even try to open crsWrongOne_2AH0TR2BK.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform