10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How <strong>Programming</strong> for Multiple Sessions WorksYou can access the DBSessionObject object through the following ways:• DBSession attribute of the FrameExec object—for running frames• ProcExec object—for 4GL procedures• MethodExec—for user class methodsFor example, the following statement assigns the name of the current session'sassociated database to the variable dbname:dbname = CurFrame.DBSession.Database;OpenROAD automatically assigns the DBSessionObject object for theapplication's starting session to the DBSession attribute of the application'sstarting component. Subsequent frames or procedures inherit theDBSessionObject from their calling component, unless you explicitly changesessions for that component.For instructions to change sessions, see Connect Method (see page 191) andHow You Can Switch Database Sessions (see page 193).How You Can Use Concurrent Frames and Multiple SessionsEach running frame in an OpenROAD application has its own FrameExecobject. Because you can set the DBSession object for each FrameExec object,concurrent frames in the application can run in different database sessions.For example, assume that an application has two concurrent frames runningand that the DBSession attribute for Frame_A is set to first_session and forFrame_B to second_session. The variables first_session and second_sessionare two reference variables of type DBSessionObject.When a user works in Frame_A, the session represented by first_session is theapplication's current session. When the user moves to Frame_B, theapplication's current session becomes the session represented by the variablesecond_session. Each time a user switches frames, OpenROAD switches thesession in which the user is working.When you use concurrent frames in this manner, remember that transactionsand cursors do not cross sessions. In the example just mentioned, if you issuea commit statement in Frame_A, it has no effect on database statementsexecuted in Frame_B's script.190 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!