General information
Category:
Coding, syntax & commands
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only