Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tables
Message
 
To
28/12/2001 08:59:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Tables
Miscellaneous
Thread ID:
00598721
Message ID:
00598763
Views:
17
>>Hi
>> I have a startup prg file that I use to start my program. In this prg file I
>>open all my tables. I don't use a database. These are just tables. I open them
>>up with an alias. When I open a form and I go to address these tables in code
>>I get a [ File already in use error ]. Isn't everything public. Or if you open
>>a form you have to reopen the table again. If I do [ use mytable again alias
>>rac2], it seems to work. Then I close the table in the forms release method.
>>It seems having to open and close a table everytime you open or close a form
>>is a real waste of resources. I only have 5 tables in my prg. Is there anyway
>>to just open the files once and use them anywhere. Also if you do have to open
>>the file again when you open a form, when you close the form will it close
>>the workareas automatically. What about toolbars, will a toolbar object see
>>the tables I opened in my startup prg.. Going to try this now. Thanks for any
>>help offered.
>
>John,
>You open the tables on startup and then in form code do :
>
>use mytable
>
>It would work :
>-If form.datasession is private
>-Or if current alias is myTable
>
>Oherwise it'd error 'File in use' meaning it's already used in another workarea. If you're using this style than instead of 'use' use 'select' later to switch areas.
>
>However I disagree opening-closing each time within a form is waste of resources. Open-close really take very small time slices compared to rest of form objects created. Especially if tables are opened from dataenvironment and not from a method.

Cetin,

I disagree that you disagree, so you disagree with me. And who am I to disagree with YOU. Anyhow, I do ... ;))

I know, it was me just "prooving" in the other thread that 80 (160) files can be opened in a sec. That creating objects takes relatively more time ? maybe (and maybe not), but is that relevant ? IMO unnessecary network traffic should be avoided always. And the opening of files can't be cached (at the client) ...
Re-opening files for each datasession makes it even worse for that matter.

Sorry that I disagreed,
Peter



>From my POV it'd encapsulate the tables and might prove to prevent headaches. Private datasessions were an enhancement to language and I think if it existed from the beginning would be the default setting.
>
>So here is my suggestion :
>-Use private datasessions
>-Put your tables in form.dataenvironment
>-Add your code for setting environment to your form class load or DE.BeforeOpenTables (See datasession topic for which 'set' are scoped to current datasession)
>-Do not touch AutoOpenTables, AutoCloseTables etc defaults
>
>For toolbars or any other object if you ever get into trouble you could simply set datasession to activeform's datasessionid.
>
>Not having the tables open all the time might save you from some corruption risks too.
>Cetin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform