Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Making unique cursor name?
Message
From
02/02/2008 13:56:17
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
02/02/2008 12:21:54
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01288050
Message ID:
01288530
Views:
13
>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform