Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object and datasessions (again)
Message
From
21/07/1999 19:03:32
 
 
To
21/07/1999 16:32:39
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00244270
Message ID:
00244447
Views:
12
>>Unless I am missing something, it seems to search in the datsession in which it was created.
>
>I don't think so. Honestly, I don't use private datasessions so my knowledge here is quite limited, but logically any external code should access current datasession.

Alex is right. Objects always live in the datasession they were created in, unless they explicitly SET DATASESSION TO.

Say I have a custom class that has a method that returns whether or not a certain table is open.

USE MyTable
oTest = CREATEOBJECT("Tester")
?oTest.IsOpen() && Return .T.

* Now, get a new datasession

loSession = CREATEOBJECT("Session")
SET DATASESSION TO (loSession.DataSessionID)
?USED("Campus") && Returns .F., because it is open in the original datasession
?oTest.IsOpen() && Return .T., because the Test object is still living in that datasession

DEFINE CLASS Tester AS Custom
PROCEDURE IsOpen
RETURN USED("MyTable")
ENDDEFINE





Alex, this has nothing to do with object or variable scope. Objects are scoped according to the scope of the variable that references them, completely untied from datasession. The only thing that datasession dictates is which work areas an object has access to at any given time.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform