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.

Handling Database ErrorsHow You Can Switch Sessions for 3GL and Database ProceduresTo use 4GL code to switch the session for a 3GL procedure, you must do sobefore you call the procedure. For example, the following code could appear inan event block:on click add =beginCurFrame.DBSession = second_session;status = callproc check_name(name = cus_name);CurFrame.DBSession = first_session;end;You can use Embedded SQL to switch sessions within a 3GL procedure.However, when the procedure completes and control returns to OpenROAD,the application automatically returns to the session in which it was runningwhen the procedure was called.You cannot switch sessions within a database procedure. If you want the tasksin a database procedure to be performed in a different session, you mustchange the session before you call the procedure.How You Can Disconnect a SessionOpenROAD provides the Disconnect method for closing open connections. Thesyntax is:integer = DBSessionObject.Disconnect()DBSessionObjectSpecifies the object that represents the session you want to closeOpenROAD also disconnects an open session if you remove all references tothe session (set all references to the DBSessionObject for the session to null).In either case, closing a session closes any open cursors and query objects inthat session and commits any transaction open in the session.Handling Database ErrorsThis section describes the tools available in OpenROAD to detect and trapDBMS errors. Using these tools, you can develop an error-handling strategyappropriate for your application's needs. Several possible strategies aredescribed, with an example of each.Working with a Database 197

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

Saved successfully!

Ooh no, something went wrong!