Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Moving between datasessions
Message
De
11/01/2008 14:47:25
 
 
À
11/01/2008 13:21:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01281189
Message ID:
01281231
Vues:
12
>>We have several routines which run SQL SELECT statements against tables which may or may not already be open. In addition, they may open an unknown number of additional cursors (cur(1), cur(2),...cur(n) depending on the data.
>>
>>It might be better to write a cleanup routine but I was wondering if it is possible to open a new datasession, do the processing there, move the resulting cursor to the main datasession, and then close the new datasession.
>>
>>So............Is there a simple way to copy a cursor from one datasession to another?
>
>No to your immediate question.

Oh well!!!

>
>There's really no reason to do this clean-up, since all those open tables don't cause any harm.

In general (and in my particular instance) this is true. Since that's true, it's also something that I have ignored for the umpty-ump years I've been working with Fox. But the routine opened over 20 tables and I thought that was a bit much and should be cleaned up. (Kinda strange I've never really developed a way of doing this since one of my mantras is that a routine should never unintentionally return an environment different from when it started)

>But if you really want to, I have written a class to handle this. It's included with my Taming SQL book (chapter 8) and also the presentation I've done for the last couple of years ("Solving common problems with VFP's SQL").
>
>Basically, I have a class that wraps the SQL command. You pass the command to a RunSQL method. The RunSQL method calls a method to get a list of what's open, then runs the command, then gets another list of what's open, then matches the two lists and closes the newly opened tables, except for the query result.
>
>It's a lot of code for a message, but if you don't have access to it, let me know and I'll post it.
>
Thanks for the offer but I had something about 50% mentally coded before I got the idea of switching datasessions. I'm pretty sure I'll be able to work something out fairly quickly.

Rest assured.....if I come across a stumbling block you (and the rest of UT) will be the first to know.

>Tamar

As always your help is greatly appreciated.

........Rich
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform