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 WorksIt is not necessary to switch back to the original session before the event blockcompletes. Event block execution can begin in one session and end in another.However, if your frame has event blocks defined for any database events, theframe receives these events only when the application is running in the samesession in which you registered the events for the frame. If you switchsessions in an event block to perform a task, be sure to switch back to thesession in which the database events are expected.For example, assume that session1 has registered for a database event andthe current event block has changed sessions to session2. If a database eventarrives while session2 is active, session1 does not receive the event.For more information about database events, see Inter-Frame CommunicationTechniques (see page 333).If you open a new database session for the current frame in an event block,you must explicitly switch the current frame to the newly opened session. Thefollowing example opens a connection to the videos database and switches tothe session for the current frame:on click chg_session_btn =beginstatus = videos_session.Connect (database ='videos');Curframe.DBsession = videos_session;end;How You Can Switch Sessions for a 4GL ProcedureTo switch sessions from within a local 4GL procedure, you must set theCurProcedure.DBSession attribute for the ProcExec object. For example, thefollowing statement switches the current procedure to the session representedby the DBSessionObject third_session:CurProcedure.DBSession = third_session;Note: In contrast to the CurProcedure.DBSession attribute, setting theCurFrame.DBSession attribute from within a local procedure will not changethe local procedure's session. Instead, it changes the calling frame's sessionafter the local procedure returns.196 <strong>Programming</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!