Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best coding practices regarding open/unopen tables
Message
From
19/12/2003 15:35:42
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00859873
Message ID:
00860823
Views:
26
>An application I am working on opens tables at the beginning and does not close the tables until the end. The application does not use private data sessions. The assumption throughout is that these tables are always open. Of course, like many apps, as it expands things accidentally get close, crashes happen, etc. etc. and tables are not always open.
>
>Is it better in methods/programs to make sure the table is first open and if not open it or to generate an error and try to figure out why the table was closed in the first place and fix that problem?

Hi Darrell,

In the Fox systems I've inherited and the first ones I created, we opened all the tables at the beginning but experienced the same problems that you have.

n my later systems, I switched to private data sessions for nearly all my forms handling the opening and closing of tables in the Load and Unload form events. This has helped reduce the problems of table availability quite a bit with a side benefit of allowing me to test and troubleshoot my systems a form at a time in the runtime environment.

In my latest system, I've started using data objects which, so far, has nearly eliminated the above problems. I don't have an answer yet on how this affects performance since this portion of the system has not yet been deployed.

Any way you go, I think it's better to open your tables, views, cursors as close to when you need them as possible, make sure they are open when accessing them and also generate a message to an error log table to give you an idea of where to begin hunting down the cause of the problem.

Hope this helps,

Jason
---------
Single field, surrogate primary keys....because it's sexier!

Third normal form is more than just a good idea.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform