dbTalk Databases Forums  

Free Tables, Data Environments and Sessions

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss Free Tables, Data Environments and Sessions in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
deciacco
 
Posts: n/a

Default Free Tables, Data Environments and Sessions - 09-09-2005 , 01:20 PM






Ok...
Lets say we have free tables in two different directories. Directories
"DirA" and "DirB". The tables in the two directories have the same
names but different structure. How can I work with the tables in these
two directories?

I know the obvious thing is to use the USE statement and an alias. But
I was wondering if there was a way to use Fox's object model to get
around this. I've been reading the book "Build Your Own Framework with
Visual FoxPro" and the author writes about Data Environments and
Sessions. I don't quite understand it as I'm pretty new to fox, but I
think you can create a data environment object and then a data session
within that environment. This leads me to believe that for my little
scenario above, I could create a data environment object for each of my
directories. Within each DE, specify a path to the appropriate
directory and then work with the tables.

I'n not quite sure if this is possible nor exactly where to start with
code. (Would I create a custom object inheriting from the DE class? How
would I associate data tables/sessions to the DE?)

Any thoughts?

Thanks.


Reply With Quote
  #2  
Old   
Dan Freeman
 
Posts: n/a

Default Re: Free Tables, Data Environments and Sessions - 09-09-2005 , 03:33 PM






Data environments are probably not the best place for a newcomer to VFP to
start, and they've changed a bit in the last few releases so the book you're
reading may be correct about general stuff but may be outdated in what's
*necessary*.

Basically, each DataEnvironment uses a Session and that's pretty much the
end of the relationship between the two.

A session is a very useful class. If you're familiar with traditional
Xbase's system of "workareas", each Session is a fresh set of workareas that
operates completely independently of each other.

Stick to your idea to USE the dbf's with aliases. It'll make your code
cleaner and easier to maintain.

Dan



deciacco wrote:
Quote:
Ok...
Lets say we have free tables in two different directories. Directories
"DirA" and "DirB". The tables in the two directories have the same
names but different structure. How can I work with the tables in these
two directories?

I know the obvious thing is to use the USE statement and an alias. But
I was wondering if there was a way to use Fox's object model to get
around this. I've been reading the book "Build Your Own Framework with
Visual FoxPro" and the author writes about Data Environments and
Sessions. I don't quite understand it as I'm pretty new to fox, but I
think you can create a data environment object and then a data session
within that environment. This leads me to believe that for my little
scenario above, I could create a data environment object for each of
my directories. Within each DE, specify a path to the appropriate
directory and then work with the tables.

I'n not quite sure if this is possible nor exactly where to start with
code. (Would I create a custom object inheriting from the DE class?
How would I associate data tables/sessions to the DE?)

Any thoughts?

Thanks.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.