[+/-]
- 2.3.30.1 NdbTransaction::close()
- 2.3.30.2 NdbTransaction::commitStatus()
- 2.3.30.3 NdbTransaction::CommitStatusType
- 2.3.30.4 NdbTransaction::deleteTuple()
- 2.3.30.5 NdbTransaction::ExecType
- 2.3.30.6 NdbTransaction::execute()
- 2.3.30.7 NdbTransaction::executePendingBlobOps()
- 2.3.30.8 NdbTransaction::getGCI()
- 2.3.30.9 NdbTransaction::getMaxPendingBlobReadBytes()
- 2.3.30.10 NdbTransaction::getMaxPendingBlobWriteBytes()
- 2.3.30.11 NdbTransaction::getNdbError()
- 2.3.30.12 NdbTransaction::getNdbErrorLine()
- 2.3.30.13 NdbTransaction::getNdbErrorOperation()
- 2.3.30.14 NdbTransaction::getNdbIndexOperation()
- 2.3.30.15 NdbTransaction::getNdbIndexScanOperation()
- 2.3.30.16 NdbTransaction::getNdbOperation()
- 2.3.30.17 NdbTransaction::getNdbScanOperation()
- 2.3.30.18 NdbTransaction::getNextCompletedOperation()
- 2.3.30.19 NdbTransaction::getTransactionId()
- 2.3.30.20 NdbTransaction::insertTuple()
- 2.3.30.21 NdbTransaction::readTuple()
- 2.3.30.22 NdbTransaction::refresh()
- 2.3.30.23 NdbTransaction::releaseLockHandle()
- 2.3.30.24 NdbTransaction::scanIndex()
- 2.3.30.25 NdbTransaction::scanTable()
- 2.3.30.26 NdbTransaction::setMaxPendingBlobReadBytes()
- 2.3.30.27 NdbTransaction::setMaxPendingBlobWriteBytes()
- 2.3.30.28 NdbTransaction::setSchemaObjectOwnerChecks()
- 2.3.30.29 NdbTransaction::unlock()
- 2.3.30.30 NdbTransaction::updateTuple()
- 2.3.30.31 NdbTransaction::writeTuple()
Abstract
This section describes the NdbTransaction class
and its public members.
Parent class. None
Child classes. None
Description.
A transaction is represented in the NDB API by an
NdbTransaction object, which belongs to an
Ndb object and is created using
Ndb::startTransaction(). A
transaction consists of a list of operations represented by the
NdbOperation class, or by one of
its
subclasses—NdbScanOperation,
NdbIndexOperation, or
NdbIndexScanOperation. Each
operation access exactly one table.
Using Transactions.
After obtaining an NdbTransaction object, it is
employed as follows:
-
An operation is allocated to the transaction using any one of the following methods:
getNdbOperation()getNdbScanOperation()getNdbIndexOperation()getNdbIndexScanOperation()
Calling one of these methods defines the operation. Several operations can be defined on the same
NdbTransactionobject, in which case they are executed in parallel. When all operations are defined, theexecute()method sends them to theNDBkernel for execution. -
The
execute()method returns when theNDBkernel has completed execution of all operations previously defined.ImportantAll allocated operations should be properly defined before calling the
execute()method. -
execute()operates in one of the three modes listed here:NdbTransaction::NoCommit: Executes operations without committing them.NdbTransaction::Commit: Executes any remaining operation and then commits the complete transaction.NdbTransaction::Rollback: Rolls back the entire transaction.
execute()is also equipped with an extra error handling parameter, which provides the two alternatives listed here:NdbOperation::AbortOnError: Any error causes the transaction to be aborted. This is the default behavior.NdbOperation::AO_IgnoreError: The transaction continues to be executed even if one or more of the operations defined for that transaction fails.
NoteIn MySQL 5.1.15 and earlier, these values were
NdbTransaction::AbortOnErrorandNdbTransaction::AO_IgnoreError.
Methods. The following table lists the public methods of this class and the purpose or use of each method:
| Method | Purpose / Use |
|---|---|
close() |
Closes a transaction |
commitStatus() |
Gets the transaction's commit status |
deleteTuple() |
Delete a tuple using NdbRecord
|
execute() |
Executes a transaction |
executePendingBlobOps() |
Executes a transaction in NoCommit mode if it
includes any blob part operations of the specified types
that are not yet executed. |
getGCI() |
Gets a transaction's global checkpoint ID (GCI) |
getMaxPendingBlobReadBytes() |
Get the current BLOB read batch size |
getMaxPendingBlobWriteBytes() |
Get the current BLOB write batch size |
getNdbError() |
Gets the most recent error |
getNdbErrorLine() |
Gets the line number where the most recent error occurred |
getNdbErrorOperation() |
Gets the most recent operation which caused an error |
getNextCompletedOperation() |
Gets operations that have been executed; used for finding errors |
getNdbOperation() |
Gets an NdbOperation
|
getNdbScanOperation() |
Gets an NdbScanOperation
|
getNdbIndexOperation() |
Gets an NdbIndexOperation
|
getNdbIndexScanOperation() |
Gets an NdbIndexScanOperation
|
getTransactionId() |
Gets the transaction ID |
insertTuple() |
Insert a tuple using NdbRecord
|
readTuple() |
Read a tuple using NdbRecord
|
refresh() |
Keeps a transaction from timing out |
releaseLockHandle() |
Release an NdbLockHandle object once it is no longer
needed |
scanIndex() |
Perform an index scan using NdbRecord
|
scanTable() |
Perform a table scan using NdbRecord
|
setMaxPendingBlobReadBytes() |
Set the BLOB read batch size |
setMaxPendingBlobWriteBytes() |
Set the BLOB write batch size |
setSchemaObjectOwnerChecks() |
Enable or disable schema object ownership checks |
unlock() |
Create an unlock operation on the current transaction |
updateTuple() |
Update a tuple using NdbRecord
|
writeTuple() |
Write a tuple using NdbRecord
|
The methods
readTuple(),
insertTuple(),
updateTuple(),
writeTuple(),
deleteTuple(),
scanTable(), and
scanIndex() require
the use of NdbRecord.
Types.
NdbTransaction defines 2 public types as shown
in the following table:
| Type | Purpose / Use |
|---|---|
CommitStatusType() |
Describes the transaction's commit status |
ExecType() |
Determines whether the transaction should be committed or rolled back |
Class diagram.
This diagram shows all the available methods and enumerated types
of the NdbTransaction class:
