Using Transactions

   

Transactions are an integral part of a client/server database. IBExpress provides the TIBTransaction component to manage transactions. Each TIBTransaction component handles one transaction on the database to which it is assigned.

A TIBTransaction component enables you to specify the properties of a transaction. These are stored in the Params property of the component. TIBTransaction has a built-in editor that enables you to use four predefined transaction settings. In Bug Tracker, we will use the Read Committed setting. InterBase and IBExpress both default to the transaction to Snapshot. Changing to Read Committed is a normal first step when dropping a new TIBTransaction onto a data module or form.

CAUTION

Most problems involving disappearing data or incorrectly updated information can be traced back to an error in implementing a transaction. With the version of IBExpress that we used for this section (version 4.1), we were occasionally surprised by an unexpected commit that occurred on a record post.

This problem was because of a known logic bug in IBExpress wherein a dataset will commit a transaction that it autostarts if there are no other active datasets when it closes . This bug was scheduled for repair in a later update of IBExpress, and might have been fixed in C++ Builder 6. In the meantime, it is a good idea not to allow datasets to autostart transactions, but instead to start them yourself.

If you run across a problem such as this, the TIBSQLMonitor component is invaluable for tracing the transaction events that are occurring.



   
Top


C++ Builder Developers Guide
C++Builder 5 Developers Guide
ISBN: 0672319721
EAN: 2147483647
Year: 2002
Pages: 253

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net