Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best coding practices regarding open/unopen tables
Message
 
À
21/12/2003 05:09:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00859873
Message ID:
00861099
Vues:
25
>And note that if you have many Select statements after each other all from the same dbf, VFP will open the dbf only once. Unless you specifically close the 'connection' to the dbf, it will remain open until you close your application.
>

Sure, that's my point. Closing the DBF explicitly can cause a very noticable slowdown. If you're going to be needing the DBF again (because you're calling it in a loop, etc.) then you should leave it open. In the cases I've seen, the function did one discrete operation - a look up, a calculation, etc. then returned the result. Inside of the function they opened a table, did the work, then closed it. It looks reasonable enough.

My point is that you need to look at how the function/method/whatever is being used to decide whether you should keep the table open or not. Opening a table a few times seems relatively quick (and most of the time you'll be perfectly happy with the performance). But, you'll suddenly notice how "slow" it becomes when you start doing that a few hundred times.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform