10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How <strong>Programming</strong> for Multiple Sessions WorksIf the reference variable was declared as a local variable in the callingframe, you must pass the variable to the called frame as a parameter andthen assign the value to the DBSession attribute, for example:/* in the calling frame */field1 = callframe newframe(sessno = second_session);/* in the called frame */initialize (sessno = DBSessionObject;) =beginCurFrame.DBSession = sessno;...end;If you use FrameExec's ParentFrame attribute to assign a called frame to aparent other than the calling frame, the called frame has the same sessionas the calling frame, not of the assigned parent. The following illustrationof DBSessions and ParentFrames shows this process:How You Can Switch Sessions in an Event BlockTo change to another session only for one operation in a specific event block,set the DBSession attribute of the frame's FrameExec object in the eventblock. For example, the following event block switches to another session if thespecified condition is true:on add_customer =begin/* If customer is rejoining the club, switch** to session connected to the archived** customer database. */if old_customer = TRUECurFrame.DBsession = second_session;.../* Switch back before exiting event block */CurFrame.DBsession = first_session;end;Working with a Database 195

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

Saved successfully!

Ooh no, something went wrong!