Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best coding practices regarding open/unopen tables
Message
De
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:
00861080
Vues:
24
Hi Paul

SQL commands are not the best approach in al cases, far from. But the combination of SQL select and VFP cursors are hard to beat.

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.

>>No, the opening and closing is extremely fast, ESPECIALLY in a network environment. All network OS has advanced directory caching and other techniques to take care of that. And if you at a later time for instance want to switch to SQL server, you only have to rewrite small parts of your code.
>>
>>>does constant opening and closing of tables to execute queries cause much slowdown in your application? what about in a network environment?
>
>
>For tighter loops, or code where a table will be opened & closed a large number of times, it definitely is >very< slow. We had a case in a data conversion application where, inside of a SQL command, a developer had a function call that did a lookup & calculation, then returned the results. The function opened and closed it's lookup table on every hit. This part of the routine took over an hour to run. When I removed the code that closed the table and added a quick IF USED()/ENDIF statement the same code ran in about 10 seconds. We had to check the results a few times because we thought we broke something ;-).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform