Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

2.10 Transaction Processing

There are two ways to control transactions through Microsoft SQL Server:

Each of these methods is described below.

2.10.1 Setting Isolation Levels

You can use the isolation() method of RWDBConnection to set the isolation level of the SQL server. Table 5 shows the mapping between the IsolationType argument you pass and the isolation level set by the SQL server. Take special care when setting isolation levels as this effects all users of the SQL server.

Table 5 -- Setting the isolation level

 
RWDBConnection::IsolationTypeMicrosoft SQL Server Isolation Level
Unknown
Level 1 - SQL_TXN_READ_UNCOMMITTED
ANSILevel1
Level 1 - SQL_TXN_READ_UNCOMMITTED
ANSILevel2
Level 1 - SQL_TXN_READ_COMMITTED
ANSILevel3
Level 3 - SQL_TXN_REPEATABLE_READ
or: SQL_TXN_SERIALIZABLE

To determine the isolation level, call RWDBConnection::isolation() without an argument.

2.10.2 Using Transaction Control Methods

You can explicitly control transactions through the following methods:

These methods are implemented using the following Transact-SQL transaction statements:

An application can add the DBTools.h++ transaction methods to its code to take explicit control of its transaction blocks. Transactions may be nested and the savepoint feature is supported. The savepoint feature allows a current transaction to be partially rolled back to a marked point.


NOTE: At the time of this writing, conflicting information was found in the MS SQL Server ODBC driver documentation regarding the use of Transact-SQL transaction statements. Please see the Microsoft SQL Server readme for more information regarding transaction savepoints.

The example below demonstrates the use of the savepoint feature and the other transaction processing methods of DBTools.h++.


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.