Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic Code: Visual C++

C#
Visual Basic
Visual C++

Berkeley DB .NET API Documentation
Transaction..::.Prepare Method
Transaction Class See Also Send Feedback

Initiate the beginning of a two-phase commit.

Namespace: BerkeleyDB
Assembly: libdb_dotnet62 (in libdb_dotnet62.dll) Version: 6.2.32.0

# Syntax

C#
    public void Prepare(
    	byte[] globalId
    )

Visual Basic (Declaration)
    Public Sub Prepare ( _
    	globalId As Byte() _
    )

Visual C++
    public:
    void Prepare(
    	array<unsigned char>^ globalId
    )

#### Parameters

globalId
  Type: array< System..::.Byte >[]()[]
  The global transaction ID by which this transaction is known. This global transaction ID is returned in calls to Recover(Int32, Boolean) telling the application which global transactions must be resolved.

# Remarks

In a distributed transaction environment, Berkeley DB can be used as a local transaction manager. In this case, the distributed transaction manager must send prepare messages to each local manager. The local manager must then call Prepare and await its successful return before responding to the distributed transaction manager. Only after the distributed transaction manager receives successful responses from all of its prepare messages should it issue any commit messages.

In the case of nested transactions, preparing the parent causes all unresolved children of the parent transaction to be committed. Child transactions should never be explicitly prepared. Their fate is resolved along with their parent's during global recovery.

If there are cursor handles open when this method is called, they are all closed inside this method. And if there are errors when closing the cursor handles, the first such error is returned.

# See Also

Transaction Class
BerkeleyDB Namespace