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 You Can Manage TransactionsHow You Can Manage Multiple Sessions and TransactionsUsing the commit statement to break a single long transaction into separate,shorter transactions is an important method for increasing concurrent useraccess to data. Another way to increase concurrency is to open separatedatabase sessions for concurrent frames in an application. For moreinformation about using multiple sessions, see How <strong>Programming</strong> for MultipleSessions Works (see page 188).In OpenROAD, transactions can span event blocks and frames but notdatabase sessions. For example, assume a user begins a long transaction on atable in one frame and then needs to open a second frame to perform anupdate on a different table. The transaction in the first frame remains openwhile the user performs the update in the second frame.If an application has multiple database sessions, each session has a separatetransaction. Transactions in different database sessions can be opensimultaneously.Transactions continue across event blocks and frames until an explicit commitor rollback statement is issued in the same session in which the transactionwas opened, or until the application is terminated.For example, assume that an application has a frame used to update purchaseorders while the data entry clerk is talking to the customer on the telephone.All line items are locked for the duration of the phone call. This frame also letsthe clerk update information about the customer, such as changing a phoneextension or contact.If the frame opens two database sessions, one to update purchase orderinformation and the other to update customer information, it is not necessaryfor the frame to hold locks on the customer record while the purchase order isupdated.Any database work performed after the frame switches to the second sessioneither begins a new transaction associated with the second session orparticipates in an on-going transaction associated with that session. Thetransaction begun in the first session is still open, but there is no activityassociated with it until the frame returns to that session.Assume further that the frame calls another frame while the first frame isworking in the second session. The work performed in the called frame is partof the transaction associated with the second session. If the called frameissues a commit or rollback statement, all the work of the transaction iscommitted or rolled back, respectively, including the transaction work thatoriginated in the calling frame.Working with a Database 185

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

Saved successfully!

Ooh no, something went wrong!