Prepare Method

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_dotnet53 (in libdb_dotnet53.dll) Version: 5.3.28.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 will be known. This global transaction ID will be 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 will be 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