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

# Class V10Transaction

java.lang.Object
org.firebirdsql.gds.ng.AbstractFbTransaction
org.firebirdsql.gds.ng.wire.version10.V10Transaction

All Implemented Interfaces:
  `FbTransaction`, `ExceptionListenable`, `FbWireTransaction`

public class V10Transaction extends AbstractFbTransaction implements FbWireTransaction
`FbTransaction` implementation for the version 10 wire protocol.

Since:
  3.0
Author:
  Mark Rotteveel

- ## Field Summary

  ### Fields inherited from class org.firebirdsql.gds.ng.AbstractFbTransaction

  `exceptionListenerDispatcher, transactionListenerDispatcher`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `V10Transaction(FbWireDatabase database, int transactionHandle, TransactionState initialState)`
  Creates a new instance of V10Transaction for the specified database.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `commit()`
  Commit the transaction
  `protected FbWireDatabase`
  `getDatabase()`
  `int`
  `getHandle()`
  `byte[]`
  `getTransactionInfo(byte[] requestItems, int maxBufferLength)`
  Performs a transaction info request.
  `protected final XdrOutputStream`
  `getXdrOut()`
  `void`
  `prepare(byte[] recoveryInformation)`
  Prepare the transaction for two-phase commit/rollback.
  `void`
  `rollback()`
  Roll back the transaction

  ### Methods inherited from class org.firebirdsql.gds.ng.AbstractFbTransaction

  `addExceptionListener, addTransactionListener, addWeakTransactionListener, getState, getTransactionId, getTransactionInfo, logUnexpectedState, removeExceptionListener, removeTransactionListener, switchState, withLock`

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

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

  ### Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable

  `addExceptionListener, removeExceptionListener`

  ### Methods inherited from interface org.firebirdsql.gds.ng.FbTransaction

  `addTransactionListener, addWeakTransactionListener, getState, getTransactionId, getTransactionInfo, removeTransactionListener`

- ## Constructor Details

  - ### V10Transaction

    public V10Transaction(FbWireDatabase database, int transactionHandle, TransactionState initialState)
    Creates a new instance of V10Transaction for the specified database.

    This can either be used for an active handle (with `initialState` `TransactionState.ACTIVE`), or a reconnected (prepared) handle (with `initialState` `TransactionState.PREPARED`).

    Parameters:
      `database` - FbWireDatabase implementation
      `transactionHandle` - Transaction handle
      `initialState` - The initial state of the transaction (only `ACTIVE` or `PREPARED` allowed).

- ## Method Details

  - ### getXdrOut

    protected final XdrOutputStream getXdrOut() throws SQLException
    Throws:
      `SQLException`

  - ### getDatabase

    protected FbWireDatabase getDatabase()
    Overrides:
      `getDatabase` in class `AbstractFbTransaction`

  - ### getHandle

    public int getHandle()
    Specified by:
      `getHandle` in interface `FbTransaction`
    Returns:
      The Firebird transaction handle identifier

  - ### commit

    public void commit() throws SQLException
    Description copied from interface: `FbTransaction`
    Commit the transaction
    Specified by:
      `commit` in interface `FbTransaction`
    Throws:
      `SQLException`

  - ### rollback

    public void rollback() throws SQLException
    Description copied from interface: `FbTransaction`
    Roll back the transaction
    Specified by:
      `rollback` in interface `FbTransaction`
    Throws:
      `SQLException`

  - ### prepare

    public void prepare(byte[] recoveryInformation) throws SQLException
    Description copied from interface: `FbTransaction`
    Prepare the transaction for two-phase commit/rollback.
    Specified by:
      `prepare` in interface `FbTransaction`
    Parameters:
      `recoveryInformation` - Transaction recovery information (stored in RDB$TRANSACTION_DESCRIPTION of RDB$TRANSACTIONS), or `null` to prepare without recovery information.
    Throws:
      `SQLException`

  - ### getTransactionInfo

    public byte[] getTransactionInfo(byte[] requestItems, int maxBufferLength) throws SQLException
    Description copied from interface: `FbTransaction`
    Performs a transaction info request.
    Specified by:
      `getTransactionInfo` in interface `FbTransaction`
    Parameters:
      `requestItems` - Information items to request
      `maxBufferLength` - Maximum response buffer length to use
    Returns:
      The response buffer (note: length is the actual length of the response, not `maxBufferLength`
    Throws:
      `SQLException` - For errors retrieving the information.