Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng

# Class TransactionHelper

java.lang.Object
org.firebirdsql.gds.ng.TransactionHelper

public final class TransactionHelper extends Object
Class with static helper methods for use with transactions

Since:
  3.0
Author:
  Mark Rotteveel

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `checkTransactionActive(FbTransaction transaction)`
  Checks if the transaction is `TransactionState.ACTIVE`.
  `static void`
  `checkTransactionActive(FbTransaction transaction, int fbErrorCode)`
  Checks if the transaction is `TransactionState.ACTIVE`.
  `static boolean`
  `isTransactionEnding(FbTransaction transaction)`
  Checks if the transaction is ending (meaning its state is `TransactionState.COMMITTING`, `TransactionState.ROLLING_BACK` or `TransactionState.PREPARING`).

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### checkTransactionActive

    public static void checkTransactionActive(FbTransaction transaction) throws SQLException
    Checks if the transaction is `TransactionState.ACTIVE`.
    Parameters:
      `transaction` - transaction to check
    Throws:
      `SQLException` - when `transaction` is `null`, or its state is not active

  - ### checkTransactionActive

    public static void checkTransactionActive(FbTransaction transaction, int fbErrorCode) throws SQLException
    Checks if the transaction is `TransactionState.ACTIVE`.
    Parameters:
      `transaction` - transaction to check
      `fbErrorCode` - Firebird error code to use for generating the exception message
    Throws:
      `SQLException` - when `transaction` is `null`, or its state is not active

  - ### isTransactionEnding

    public static boolean isTransactionEnding(FbTransaction transaction)
    Checks if the transaction is ending (meaning its state is `TransactionState.COMMITTING`, `TransactionState.ROLLING_BACK` or `TransactionState.PREPARING`).
    Parameters:
      `transaction` - transaction to check
    Returns:
      `true` if the state is `COMMITTING`, `ROLLING_BACK` or `PREPARING`, otherwise `false` (including when `transaction` is `null`)
    Since:
      6