Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best coding practices regarding open/unopen tables
Message
From
21/12/2003 13:46:00
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00859873
Message ID:
00861119
Views:
29
Yes, we totally agree. As you know, with VFP the answer to most questions is 'it depends'!

>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform