Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Close all, Except...
Message
From
01/01/2007 09:34:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
01/01/2007 08:17:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01181173
Message ID:
01181194
Views:
19
This message has been marked as the solution to the initial question of the thread.
>I don't think it's big problem.
>
>I have to create a cursor in the procedure begining with all the opend tables/cursors.
>
>Now, I have to create another cursor in the procedure end and to run on the second cursor 'scan/use in/endscan' only if the cursor/table not apeared in the first.
>
>In this way I will not have to change parameters.

That sounds like an interesting idea. An array, to contain the list of tables, would be better encapsulation (the cursor name might conflict with another cursor name), but a cursor is easier to manage. I suggest you use sys(2015) to create the cursor name, that way, you can save/restore open tables at more than one level.

>My question is what is the way to do it.

Well, which part are you missing?

I suggest to do all this in an object. That way, you only need the following commands at beginning of each procedure:
local loSaveTableList
loSaveTableList = CreateObject("cSaveTableList")
The Init() event of the class will save the list of tables; the Destroy() event will close tables that were not previously open.

That way, you don't need any additional command at the end of every procedure! Once the variable loSaveTableList gets out of scope (at the end of the procedure), the object's Destroy() event is invoked automatically.

However, better to the cleanup in a separate procedure, so that you can call it separately, just in case. Destroy() would then invoke the method that does the cleanup.

Init() might also invoke a separate method that saves the environment, just in case.

-------

The list of open aliases, you get with aused(). You will have to loop through the resulting array, and copy the aliases to a cursor - if you want to use a cursor.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform