IsInTransaction

Description

Indicates whether a component is executing in a transaction.

Applies to

TransactionServer objects

Syntax

transactionserver.IsInTransaction (  )

Argument

Description

transactionserver

Reference to the TransactionServer service instance

Returns

Boolean. Returns true if the component is executing as part of a transaction and false if it is not.

Usage

Component methods can call IsInTransaction to determine whether they are executing within a transaction.

Methods in components that are declared to be transactional always execute as part of a transaction.

Methods in components that have a transaction type of Supports Transaction may or may not be running in the context of an EAServer transaction, depending on whether the component is instantiated directly by a base client or by another component. In components that have this transaction type, you can use IsInTransaction to determine whether the component is running in a transaction.

The IsInTransaction function corresponds to the isInTransaction transaction primitive in EAServer.

Examples

Example 1

The following example shows the use of the IsInTransaction function:

TransactionServer ts

Integer li_rc

long ll_rv


li_rc = this.GetContextService("TransactionServer", &

    ts)

IF ts.IsInTransaction = TRUE THEN

    // execute logic based on the transaction context

END IF

See also