Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disappearing alias?
Message
From
24/01/2005 20:21:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
24/01/2005 15:42:40
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00977939
Message ID:
00980247
Views:
36
>If I invoke a PRG to create a cursor for me, and if that PRG needs to create some other cursors along the way, there seems to be no consistent way to handle this.

You can have your own cursor creator class, which will also close the cursor when its variable goes out of scope. In pseudo-code:
local oCursor
oCursor=create("mycursor")
oCursor.cStatement="select * from mytable into cursor zz"
{lots of code here}
return

*------------
define class myCursor as custom

cAlias=""
cStatement=""

procedure fill
execscript(this.cStatement)
this.cAlias=alias()
endproc

procedure destroy
use in select(this.cAlias)
endproc
enddefine
Since oCursor is local, it will be destroyed when your procedure exits. You can add a lot of other stuff to the class, of course - have it index the cursor etc etc.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform