Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
>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.
There's really no reason to do this clean-up, since all those open tables don't cause any harm. 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.
Tamar
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement