The procedure for using transactions is as follows:
Start a transaction (instantiate an
NdbTransaction
object).
Add and define operations associated with the transaction
using instances of one or more of the
NdbOperation
,
NdbScanOperation
,
NdbIndexOperation
, and
NdbIndexScanOperation
classes.
Execute the transaction (call
NdbTransaction::execute()
).
The operation can be of two different types —
Commit
or NoCommit
:
If the operation is of type
NoCommit
, then the application
program requests that the operation portion of a
transaction be executed, but without actually
committing the transaction. Following the execution
of a NoCommit
operation, the
program can continue to define additional
transaction operations for later execution.
NoCommit
operations can also be
rolled back by the application.
If the operation is of type
Commit
, then the transaction is
immediately committed. The transaction must be
closed after it has been committed (even if the
commit fails), and no further operations can be
added to or defined for this transaction.
See Section 2.3.19.1.3, “The NdbTransaction::ExecType
Type”.