Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataSession and Queries ran from an object???/
Message
From
10/06/2014 11:15:24
 
 
To
10/06/2014 10:40:59
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01601560
Message ID:
01601568
Views:
52
>>Here's what I'm finding...
>>
>>Any object in FoxPro that runs a query, whether against native DBFs or Sql Server, will create the cursor in the DataSession which was active at the time the object was created.
>>
>>The means that if you have a BO created in Form A with a Private DataSession, and you pass that object to Form B which has its own Private DataSession, if you use the object to run a query from Form B, the cursor will be created in the DataSession from Form A.
>>
>>Crazy! But true. It took be about an hour of stepping through the codez to figure this out.
>>
>>Does anyone know a work around, or a pattern to avoid this??
>>
>>
>>.
>
>Did you expect it to work differently? If your object opened some tables when Form A was executing, and then you passed that object to Form B, don't you expect those tables to be still open and available? That would only be true if it still was in the same DataSession as Form A.


My gripe with this is not the handling or access of existing cursors created with the object... It's with new cursors created with that object in Form B, or Form C, etc.. I'd think it would be reasonable to expect the results from a new query run in Form X to be created in the DataSession of Form X. That's not an absurd use case. There is no concrete right or wrong way to say how this should work. VFP chose to make it work the way it does, which is not what I need in this case, so I'm seeking reasonable work-arounds to accomplish what I need.

The VFP architects could have simply added a property on Custom objects that determine "shall the results of new queries created with this object be created in the current DataSession, or the original Data Session which was active when the object was created." That would be most useful to me at this time.


.

.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform