Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Clever way to close all cursors
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00124575
Message ID:
00124863
Vues:
32
>>>In reports (sometimes in forms), I can use over half a dozen temporary cursors to extract and format data. Does anyone have a clever way of closing all cursors used in a report. I have grown tired on manually destroying all cursors at the end of a method or upon the closing of a report.
>>>
>>>Since I open all my tables at the start of the app (still the old fashioned way), I could count the highest table # and when a report or form is release make a loop to close tables and cursors higher than than number. Is there a more clever way?
>>
>>If you make the report have a private DE, you don't have to think about it. The *USE* command has an option *NoRequery DSID* where you can put *1* for the DSID and it will use the information in the already opened tables in the default DS (i.e., little or no performance hit).
>
>I don't understand... perhaps we are talking about two different things.
>
>The temporary cursors that I am refering to are created using SQL-select statements. It is these that I want to close, not the actual tables.

Regardless, if all this is done in a private DS, all will be released when the form is released or the report is finished. I actually use a form class to generate my reports. The form has a private DS, and I add methods to open tables, views and create cursors. Then I have a method to run the report.

I have taken advantage of the *USE NOREQUERY 1* command to open already opened views (you get the same data already in the view) without taking a performance hit. I can live with the minimal hit on using tables again. In your case, I would be placing the Select-SQL commands in a method in the form.

When I release the form, all tables, views and cursors are closed for me.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform