Class: TSQLTransactionHandle

Declaration: SQLDataAccess.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

This concrete class controls the committing or rolling back of a database transaction. Multiple transaction handles can exist for a single transaction. The transaction itself requires unanimous Commit vote from all of its handles before committing. Any rollback or uncommitted destruction of a transaction handle causes the actual transaction to rollback. All SQLDAS/Base editing commands are committed as individual units of work. Instances of TSQLTransactionHandle can be used freely with SQLDAS/Base editing commands to extend the unit of work. The transaction is committed when the outermost transaction object is committed.

Instantiation:

Always allocate on the stack.

Deriving Classes:

None. Providers will probably not need to derive from this class.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TSQLTransactionHandle::TSQLTransactionHandle

  1. TSQLTransactionHandle ()
  2. TSQLTransactionHandle (const TSQLTransactionHandle &)

Interface Category:

API.

Purpose:

  1. Default constructor. SQL transaction handles are created by a connection when the client application invokes the CreateSQLTransaction member function.
  2. Clients can use the default constructor to create an empty transaction handle. The only thing that a client should do with such a handle to assign a valid SQL transaction handle to it.
  3. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and any other function that needs to construct an uninitialized object.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSQLTransactionHandle::~TSQLTransactionHandle

virtual ~ TSQLTransactionHandle ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The semantics of destruction are special in that the destruction of an uncommitted transaction handle results in a rollback of the associated transaction. This design allows transactions to be rolled back automatically when a transaction handle is destroyed by a thrown exception.

Member Function: TSQLTransactionHandle::Commit

virtual void Commit ()

Interface Category:

API.

Purpose:

Registers this transaction handle's vote for committing the associated transaction.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through. Any attempt to recommit or rollback a committed transaction handle results in an exception.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSQLTransactionHandle::Rollback

virtual void Rollback ()

Interface Category:

API.

Purpose:

Immediately rolls back the associated transaction.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through. Any attempt to recommit or rollback a rolled back transaction handle results in an exception.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSQLTransactionHandle::GetState

virtual ETransactionState GetState () const

Interface Category:

API.

Purpose:

Returns the current state of the transaction associated with the handle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The current state of the transaction.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSQLTransactionHandle::operator=

TSQLTransactionHandle & operator =(const TSQLTransactionHandle &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TSQLTransactionHandle::SetConnection

virtual void SetConnection (TSQLConnection *)

Interface Category:

API.

Purpose:

Binds an uninitialized transaction handle into a connection.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.