Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Temporary private data session
Message
From
09/03/2000 11:25:50
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00343415
Message ID:
00343704
Views:
26
>I'm looking to get some opinions to maybe prevent some headaches down the road.
>
>I have an object that is already running under a private datasession form object. I'm trying to use some temp cursors to build a hierarchical object based off some XML DTD files. What I'd like to do is for the lifetime of a certain method put the object into it's own datasession so it can freely create cursors that are only used for SCATTER NAME purposes to build the object. I don't want to have to worry about cursor name conflicts between the tables/views/cursors currently in use and the element names of the DTD.
>
>If I instantiate a Session object in a method, will it put the method into a new private ds that will disappear when the session object goes out of scope? For example:
>
>loSession = createobject( "session" )
>create cursor TheRootElement ( ... )
>scatter name this.TheRootElement
>create cursor ASubordinateElement ( ... )
>scatter name this.TheRootElement.ASubordinateElement
>loSession = .null. && poof all the cursors and return to the priv ds
>
>TIA

Try...

loSession = createobject( "session" )
SET DATASESSION TO (loSession.SessionID)
create cursor TheRootElement ( ... )
scatter name this.TheRootElement
create cursor ASubordinateElement ( ... )
scatter name this.TheRootElement.ASubordinateElement
loSession = .null. && poof all the cursors and return to the priv ds
SET DATASESSION TO

David, you were creating the private data session but never switcing to it, which is why when you destroyed the session object your cursors didn't close. After you do your create cursors, suspend and open your VIEW window to make sure they are open in your new session.

BTW: I am doing this in my ap and it works great. Same idea, different implementation.

BOb
Previous
Reply
Map
View

Click here to load this message in the networking platform