Commit 356d343c authored by unknown's avatar unknown

backwards compatible name change NdbConnectionto NdbTransaction

removed friend declarations from doxygen
updated some documentation in mgmapi


BitKeeper/deleted/.del-NdbCursorOperation.hpp~da121aeaf101b136:
  Delete: ndb/include/ndbapi/NdbCursorOperation.hpp
BitKeeper/deleted/.del-NdbCursorOperation.cpp~8d49480ced2deba5:
  Delete: ndb/src/ndbapi/NdbCursorOperation.cpp
ndb/include/Makefile.am:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/kernel/signaldata/ScanTab.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/kernel/signaldata/TcCommit.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/kernel/signaldata/TcHbRep.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/kernel/signaldata/TcIndx.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/kernel/signaldata/TcKeyConf.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/kernel/signaldata/TcKeyFailConf.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/kernel/signaldata/TcRollbackRep.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/kernel/signaldata/TransIdAI.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/mgmapi/mgmapi.h:
  backwards compatible name change NdbConnectionto NdbTransaction
  documented some missing things in mgmapi
ndb/include/ndbapi/Ndb.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbApi.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbBlob.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbDictionary.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbEventOperation.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbIndexOperation.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbIndexScanOperation.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbOperation.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbRecAttr.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbReceiver.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbScanFilter.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbScanOperation.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/include/ndbapi/NdbTransaction.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/Makefile.am:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/Ndb.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbApiSignal.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbBlob.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbImpl.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbIndexOperation.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbOperation.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbOperationDefine.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbOperationExec.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbOperationInt.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbOperationSearch.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbReceiver.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbScanOperation.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbTransaction.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/NdbTransactionScan.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/Ndberr.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/Ndbif.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/Ndbinit.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/src/ndbapi/Ndblist.cpp:
  backwards compatible name change NdbConnectionto NdbTransaction
ndb/tools/restore/consumer_restore.hpp:
  backwards compatible name change NdbConnectionto NdbTransaction
sql/ha_ndbcluster.h:
  backwards compatible name change NdbConnectionto NdbTransaction
parent fde8d07d
......@@ -9,8 +9,7 @@ ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \
ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \
ndbapi/NdbConnection.hpp \
ndbapi/NdbCursorOperation.hpp \
ndbapi/NdbTransaction.hpp \
ndbapi/NdbDictionary.hpp \
ndbapi/NdbError.hpp \
ndbapi/NdbEventOperation.hpp \
......
......@@ -33,7 +33,7 @@ class ScanTabReq {
/**
* Sender(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbScanOperation;
friend class NdbIndexScanOperation;
......@@ -277,7 +277,7 @@ class ScanTabConf {
/**
* Reciver(s)
*/
friend class NdbConnection; // Reciver
friend class NdbTransaction; // Reciver
/**
* Sender(s)
......@@ -345,7 +345,7 @@ class ScanTabRef {
/**
* Reciver(s)
*/
friend class NdbConnection; // Reciver
friend class NdbTransaction; // Reciver
/**
* Sender(s)
......
......@@ -33,7 +33,7 @@ class TcCommitConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
public:
STATIC_CONST( SignalLength = 3 );
......@@ -60,7 +60,7 @@ class TcCommitRef {
/**
* Reciver(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
public:
STATIC_CONST( SignalLength = 4 );
......
......@@ -36,7 +36,7 @@ class TcHbRep {
/**
* Sender(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
/**
* For printing
......
......@@ -26,7 +26,7 @@ class TcIndxConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
/**
* Sender(s)
......
......@@ -27,7 +27,7 @@ class TcKeyConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class Ndbcntr;
friend class DbUtil;
......
......@@ -33,7 +33,7 @@ class TcKeyFailConf {
* Reciver(s)
*/
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
public:
STATIC_CONST( SignalLength = 3 );
......
......@@ -23,7 +23,7 @@ class TcRollbackRep {
/**
* Sender(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
friend class DbUtil;
/**
......
......@@ -28,7 +28,7 @@ class TransIdAI {
/**
* Receiver(s)
*/
friend class NdbConnection;
friend class NdbTransaction;
friend class Dbtc;
friend class Dbutil;
friend class Dblqh;
......
......@@ -363,7 +363,20 @@ extern "C" {
NdbMgmHandle ndb_mgm_create_handle();
/**
* Set connecst string to management server
* Destroy a management server handle
*
* @param handle Management handle
*/
void ndb_mgm_destroy_handle(NdbMgmHandle * handle);
/** @} *********************************************************************/
/**
* @name Functions: Connect/Disconnect Management Server
* @{
*/
/**
* Set connect string to management server
*
* @param handle Management handle
* @param connect_string Connect string to the management server,
......@@ -373,23 +386,17 @@ extern "C" {
int ndb_mgm_set_connectstring(NdbMgmHandle handle,
const char *connect_string);
int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
int ndb_mgm_get_connected_port(NdbMgmHandle handle);
const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
/**
* Destroy a management server handle
* Get connectstring used for connection
*
* @note returns what the connectstring defaults to if the above call has
* not been performed
*
* @param handle Management handle
*
* @return connectstring
*/
void ndb_mgm_destroy_handle(NdbMgmHandle * handle);
/** @} *********************************************************************/
/**
* @name Functions: Connect/Disconnect Management Server
* @{
*/
const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
/**
* Connect to a management server
......@@ -408,6 +415,33 @@ extern "C" {
*/
int ndb_mgm_disconnect(NdbMgmHandle handle);
/**
* Get nodeid used in the connection
*
* @param handle Management handle
*
* @return node id
*/
int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle);
/**
* Get port used in the connection
*
* @param handle Management handle
*
* @return port
*/
int ndb_mgm_get_connected_port(NdbMgmHandle handle);
/**
* Get host used in the connection
*
* @param handle Management handle
*
* @return hostname
*/
const char *ndb_mgm_get_connected_host(NdbMgmHandle handle);
/** @} *********************************************************************/
/**
* @name Functions: Convert between different data formats
......@@ -436,7 +470,8 @@ extern "C" {
* @param type Node type.
* @return NULL if invalid id.
*/
const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type, const char **str);
const char * ndb_mgm_get_node_type_alias_string(enum ndb_mgm_node_type type,
const char **str);
/**
* Convert a string to a ndb_mgm_node_status
......@@ -454,8 +489,10 @@ extern "C" {
*/
const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
ndb_mgm_event_category ndb_mgm_match_event_category(const char *);
const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category);
#endif
/** @} *********************************************************************/
/**
......@@ -469,6 +506,7 @@ extern "C" {
* Note the caller must free the pointer returned.
*
* @param handle Management handle.
*
* @return Cluster state (or NULL on error).
*/
struct ndb_mgm_cluster_state * ndb_mgm_get_status(NdbMgmHandle handle);
......@@ -488,6 +526,7 @@ extern "C" {
* n - Means stop n node(s) specified in the
* array node_list
* @param node_list List of node ids of database nodes to be stopped
*
* @return No of nodes stopped (or -1 on error)
*
* @note The function is equivalent
......@@ -507,6 +546,7 @@ extern "C" {
* @param node_list List of node ids of database nodes to be stopped
* @param abort Don't perform gracefull stop,
* but rather stop immediatly
*
* @return No of nodes stopped (or -1 on error).
*/
int ndb_mgm_stop2(NdbMgmHandle handle, int no_of_nodes,
......@@ -521,6 +561,7 @@ extern "C" {
* n - Means stop n node(s) specified in the
* array node_list
* @param node_list List of node ids of database nodes to be stopped
*
* @return No of nodes stopped (or -1 on error).
*
* @note The function is equivalent to
......@@ -543,6 +584,7 @@ extern "C" {
* waiting for start command
* @param abort Don't perform gracefull restart,
* but rather restart immediatly
*
* @return No of nodes stopped (or -1 on error).
*/
int ndb_mgm_restart2(NdbMgmHandle handle, int no_of_nodes,
......@@ -558,6 +600,7 @@ extern "C" {
* n - Means start n node(s) specified in
* the array node_list
* @param node_list List of node ids of database nodes to be started
*
* @return No of nodes started (or -1 on error).
*
* @note The nodes to start must have been started with nostart(-n)
......@@ -582,6 +625,7 @@ extern "C" {
* @param handle NDB management handle.
* @param level A cluster log level to filter.
* @param reply Reply message.
*
* @return -1 on error.
*/
int ndb_mgm_filter_clusterlog(NdbMgmHandle handle,
......@@ -592,6 +636,7 @@ extern "C" {
* Get log filter
*
* @param handle NDB management handle
*
* @return A vector of seven elements,
* where each element contains
* 1 if a severity is enabled and 0 if not.
......@@ -620,7 +665,7 @@ extern "C" {
enum ndb_mgm_event_category category,
int level,
struct ndb_mgm_reply* reply);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
* Set log category and levels for the Node
*
......@@ -646,6 +691,7 @@ extern "C" {
*/
int ndb_mgm_get_stat_port(NdbMgmHandle handle,
struct ndb_mgm_reply* reply);
#endif
/** @} *********************************************************************/
/**
......@@ -699,6 +745,7 @@ extern "C" {
* @param handle NDB management handle.
* @param nodeId Node Id of the single user node
* @param reply Reply message.
*
* @return -1 on error.
*/
int ndb_mgm_exit_single_user(NdbMgmHandle handle,
......@@ -709,6 +756,7 @@ extern "C" {
*
* @param filter pairs of { level, category } that will be
* pushed to fd, level=0 ends lists
*
* @return fd which events will be pushed to
*/
int ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]);
......@@ -718,12 +766,16 @@ extern "C" {
* @param handle NDB management handle.
* @param version Version of configuration, 0 means latest
* @see MAKE_VERSION
* @Note the caller must call ndb_mgm_detroy_configuration
*
* @return configuration
*
* @note the caller must call ndb_mgm_detroy_configuration
*/
struct ndb_mgm_configuration * ndb_mgm_get_configuration(NdbMgmHandle handle,
unsigned version);
void ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
int ndb_mgm_alloc_nodeid(NdbMgmHandle handle,
unsigned version, int nodetype);
/**
......@@ -749,6 +801,8 @@ extern "C" {
int param, const char ** value);
int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **);
int ndb_mgm_check_connection(NdbMgmHandle handle);
#endif
#ifdef __cplusplus
}
#endif
......
......@@ -25,7 +25,7 @@
The NDB API consists of the following fundamental classes:
- Ndb_cluster_connection class representing a connection to a cluster,
- Ndb is the main class representing the database,
- NdbConnection represents a transaction,
- NdbTransaction represents a transaction,
- NdbOperation represents a operation using primary key,
- NdbScanOperation represents a operation performing a full table scan.
- NdbIndexOperation represents a operation using a unique hash index,
......@@ -40,12 +40,12 @@
-# Construct and connect to a cluster using the Ndb_cluster_connection
object.
-# Construct and initialize Ndb object(s).
-# Define and execute transactions using NdbConnection and Ndb*Operation.
-# Define and execute transactions using NdbTransaction and Ndb*Operation.
-# Delete Ndb objects
-# Delete connection to cluster
The main structure of a transaction is as follows:
-# Start transaction, a NdbConnection
-# Start transaction, a NdbTransaction
-# Add and define operations (associated with the transaction),
Ndb*Operation
-# Execute transaction
......@@ -73,15 +73,15 @@
Synchronous transactions are defined and executed in the following way.
-# Start (create) transaction (the transaction will be
referred to by an NdbConnection object,
referred to by an NdbTransaction object,
typically created by Ndb::startTransaction).
At this step the transaction is being defined.
It is not yet sent to the NDB kernel.
-# Add and define operations to the transaction
(using NdbConnection::getNdb*Operation and
(using NdbTransaction::getNdb*Operation and
methods from class Ndb*Operation).
The transaction is still not sent to the NDB kernel.
-# Execute the transaction (using NdbConnection::execute).
-# Execute the transaction (using NdbTransaction::execute).
-# Close the transaction (using Ndb::closeTransaction).
See example program in section @ref ndbapi_example1.cpp.
......@@ -97,15 +97,15 @@
@section secNdbOperations Operations
Each transaction (NdbConnection object) consist of a list of
Each transaction (NdbTransaction object) consist of a list of
operations (Ndb*Operation objects).
Operations are of two different kinds:
-# standard operations, and
-# interpreted program operations.
<h3>Single row operations</h3>
After the operation is created using NdbConnection::getNdbOperation
(or NdbConnection::getNdbIndexOperation),
After the operation is created using NdbTransaction::getNdbOperation
(or NdbTransaction::getNdbIndexOperation),
it is defined in the following three steps:
-# Defining standard operation type
(e.g. using NdbOperation::readTuple)
......@@ -117,7 +117,7 @@
Example code (using an NdbOperation and excluding error handling):
@code
// 1. Create
MyOperation= MyConnection->getNdbOperation("MYTABLENAME");
MyOperation= MyTransaction->getNdbOperation("MYTABLENAME");
// 2. Define type of operation and lock mode
MyOperation->readTuple(NdbOperation::LM_Read);
......@@ -134,7 +134,7 @@
Example code (using an NdbIndexOperation and excluding error handling):
@code
// 1. Create
MyOperation= MyConnection->getNdbIndexOperation("MYINDEX", "MYTABLENAME");
MyOperation= MyTransaction->getNdbIndexOperation("MYINDEX", "MYTABLENAME");
// 2. Define type of operation and lock mode
MyOperation->readTuple(NdbOperation::LM_Read);
......@@ -167,7 +167,7 @@
operate on a defined unique hash index.)
@note If you want to define multiple operations within the same transaction,
then you need to call NdbConnection::getNdb*Operation for each
then you need to call NdbTransaction::getNdb*Operation for each
operation.
<h4>Step 2: Specify Search Conditions</h4>
......@@ -203,7 +203,7 @@
Thus, the application can not reference this object after
Ndb::closeTransaction have been called.
The result of reading data from an NdbRecAttr object before
calling NdbConnection::execute is undefined.
calling NdbTransaction::execute is undefined.
......@@ -333,9 +333,9 @@
not abort the transaction, it only skips the tuple and
proceeds with the next.
The skipped tuple will not be reported to the application.
-# Call NdbConnection::executeScan to define (and start) the scan.
-# Call NdbConnection::nextScanResult to proceed with next tuple.
When calling NdbConnection::nextScanResult, the lock on any
-# Call NdbTransaction::executeScan to define (and start) the scan.
-# Call NdbTransaction::nextScanResult to proceed with next tuple.
When calling NdbTransaction::nextScanResult, the lock on any
previous tuples are released.
<br>
If the tuple should be updated then it must be transferred over
......@@ -343,7 +343,7 @@
This is performed by calling
NdbOperation::takeOverForUpdate or takeOverForDelete on
the scanning transactions NdbOperation object with the updating
transactions NdbConnection object as parameter.
transactions NdbTransaction object as parameter.
<p>
If NdbOperation::takeOverFor* returns NULL then the
operation was not successful, otherwise it returns a reference
......@@ -364,7 +364,7 @@
-# NdbScanOperation::readTuplesExclusive returns a handle to a
NdbResultSet.
-# Search conditions are defined by NdbScanFilter
-# Call NdbConnection::execute(NoCommit) to start the scan.
-# Call NdbTransaction::execute(NoCommit) to start the scan.
-# Call NdbResultSet::nextResult to proceed with next tuple.
When calling NdbResultSet::nextResult(false), the lock on any
previous tuples are released and the next tuple cached in the API
......@@ -375,7 +375,7 @@
The new update operation can the be used to modify the tuple.
When nextResult(false) returns != 0, then no more tuples
are cached in the API. Updated tuples is now commit using
NdbConnection::execute(Commit).
NdbTransaction::execute(Commit).
After the commit, more tuples are fetched from NDB using
nextResult(true).
-# Use Ndb::closeTransaction as usual to close the transaction.
......@@ -469,7 +469,7 @@
chunks of data are sent when actually sending and thus decreasing
the operating system overhead.
The synchronous call to NdbConnection::execute
The synchronous call to NdbTransaction::execute
normally performs three main steps:<br>
-# <b>Prepare</b>
Check transaction status
......@@ -481,7 +481,7 @@
-# <b>Poll</b>
Wait for response from NDB kernel.
The asynchronous method NdbConnection::executeAsynchPrepare
The asynchronous method NdbTransaction::executeAsynchPrepare
only perform step 1.
(The abort part in step 1 is only prepared for. The actual
aborting of the transaction is performed in a later step.)
......@@ -492,11 +492,11 @@
synchronous transactions)
-# Add and define operations (also as in the synchronous case)
-# <b>Prepare</b> transactions
(using NdbConnection::executeAsynchPrepare or
NdbConnection::executeAsynch)
(using NdbTransaction::executeAsynchPrepare or
NdbTransaction::executeAsynch)
-# <b>Send</b> transactions to NDB Kernel
(using Ndb::sendPreparedTransactions,
NdbConnection::executeAsynch, or Ndb::sendPollNdb)
NdbTransaction::executeAsynch, or Ndb::sendPollNdb)
-# <b>Poll</b> NDB kernel to find completed transactions
(using Ndb::pollNdb or Ndb::sendPollNdb)
-# Close transactions (same way as for the synchronous transactions)
......@@ -507,24 +507,24 @@
- (Prepare-Send-Poll). This is the one-step variant provided
by synchronous transactions.
- (Prepare-Send)-Poll. This is the two-step variant using
NdbConnection::executeAsynch and Ndb::pollNdb.
NdbTransaction::executeAsynch and Ndb::pollNdb.
- Prepare-(Send-Poll). This is the two-step variant using
NdbConnection::executeAsynchPrepare and Ndb::sendPollNdb.
NdbTransaction::executeAsynchPrepare and Ndb::sendPollNdb.
- Prepare-Send-Poll. This is the three-step variant using
NdbConnection::executeAsynchPrepare, Ndb::sendPreparedTransactions, and
NdbTransaction::executeAsynchPrepare, Ndb::sendPreparedTransactions, and
Ndb::pollNdb.
Transactions first has to be prepared by using method
NdbConnection::executeAsynchPrepare or NdbConnection::executeAsynch.
NdbTransaction::executeAsynchPrepare or NdbTransaction::executeAsynch.
The difference between these is that
NdbConnection::executeAsynch also sends the transaction to
NdbTransaction::executeAsynch also sends the transaction to
the NDB kernel.
One of the arguments to these methods is a callback method.
The callback method is executed during polling (item 5 above).
Note that NdbConnection::executeAsynchPrepare does not
Note that NdbTransaction::executeAsynchPrepare does not
send the transaction to the NDB kernel. When using
NdbConnection::executeAsynchPrepare, you either have to call
NdbTransaction::executeAsynchPrepare, you either have to call
Ndb::sendPreparedTransactions or Ndb::sendPollNdb to send the
database operations.
(Ndb::sendPollNdb also polls Ndb for completed transactions.)
......@@ -550,8 +550,8 @@
objects belonging to this transaction until the transaction
callback method have been executed.
(The transaction is stated and sent by either
NdbConnection::executeAsynch or through the combination of
NdbConnection::executeAsynchPrepare and either
NdbTransaction::executeAsynch or through the combination of
NdbTransaction::executeAsynchPrepare and either
Ndb::sendPreparedTransactions or Ndb::sendPollNdb).
More about how transactions are send the NDB Kernel is
......@@ -566,7 +566,7 @@
One recommended way to handle a transaction failure
(i.e. an error is reported) is to:
-# Rollback transaction (NdbConnection::execute with a special parameter)
-# Rollback transaction (NdbTransaction::execute with a special parameter)
-# Close transaction
-# Restart transaction (if the error was temporary)
......@@ -578,14 +578,14 @@
objects and query for their NdbError objects to find out what really
happened.
NdbConnection::getNdbErrorOperation returns a reference to the
NdbTransaction::getNdbErrorOperation returns a reference to the
operation causing the latest error.
NdbConnection::getNdbErrorLine delivers the method number of the
NdbTransaction::getNdbErrorLine delivers the method number of the
erroneous method in the operation.
@code
theConnection = theNdb->startTransaction();
theOperation = theConnection->getNdbOperation("TEST_TABLE");
theTransaction = theNdb->startTransaction();
theOperation = theTransaction->getNdbOperation("TEST_TABLE");
if (theOperation == NULL) goto error;
theOperation->readTuple();
theOperation->setValue("ATTR_1", at1);
......@@ -593,9 +593,9 @@
theOperation->setValue("ATTR_3", at1);
theOperation->setValue("ATTR_4", at1);
if (theConnection->execute(Commit) == -1) {
errorLine = theConnection->getNdbErrorLine();
errorOperation = theConnection->getNdbErrorOperation();
if (theTransaction->execute(Commit) == -1) {
errorLine = theTransaction->getNdbErrorLine();
errorOperation = theTransaction->getNdbErrorOperation();
@endcode
Here errorLine will be 3 as the error occurred in the third method
......@@ -603,11 +603,11 @@
Getting errorLine == 0 means that the error occurred when executing the
operations.
Here errorOperation will be a pointer to the theOperation object.
NdbConnection::getNdbError will return the NdbError object
NdbTransaction::getNdbError will return the NdbError object
including holding information about the error.
Since errors could have occurred even when a commit was reported,
there is also a special method, NdbConnection::commitStatus,
there is also a special method, NdbTransaction::commitStatus,
to check the commit status of the transaction.
*******************************************************************************/
......@@ -654,7 +654,7 @@
@page secAdapt Adaptive Send Algorithm
At the time of "sending" the transaction
(using NdbConnection::execute), the transactions
(using NdbTransaction::execute), the transactions
are in reality <em>not</em> immediately transfered to the NDB Kernel.
Instead, the "sent" transactions are only kept in a
special send list (buffer) in the Ndb object to which they belong.
......@@ -710,7 +710,7 @@
later releases of NDB Cluster.
However, to support faster than 10 ms checks,
there has to be support from the operating system.
-# When calling NdbConnection::execute synchronously or calling any
-# When calling NdbTransaction::execute synchronously or calling any
of the poll-methods, there is a force parameter that overrides the
adaptive algorithm and forces the send to all nodes.
......@@ -876,7 +876,7 @@ class NdbEventOperationImpl;
class NdbScanOperation;
class NdbIndexScanOperation;
class NdbIndexOperation;
class NdbConnection;
class NdbTransaction;
class NdbApiSignal;
class NdbRecAttr;
class NdbLabel;
......@@ -970,10 +970,11 @@ public:
class Ndb
{
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbReceiver;
friend class NdbOperation;
friend class NdbEventOperationImpl;
friend class NdbConnection;
friend class NdbTransaction;
friend class Table;
friend class NdbApiSignal;
friend class NdbIndexOperation;
......@@ -982,6 +983,7 @@ class Ndb
friend class NdbDictionaryImpl;
friend class NdbDictInterface;
friend class NdbBlob;
#endif
public:
/**
......@@ -1075,11 +1077,11 @@ public:
*
* @param maxNoOfTransactions
* Maximum number of parallel
* NdbConnection objects that can be handled by the Ndb object.
* NdbTransaction objects that can be handled by the Ndb object.
* Maximum value is 1024.
*
* @note each scan or index scan operation uses one extra
* NdbConnection object
* NdbTransaction object
*
* @return 0 if successful, -1 otherwise.
*/
......@@ -1171,7 +1173,7 @@ public:
* Start a transaction
*
* @note When the transaction is completed it must be closed using
* Ndb::closeTransaction or NdbConnection::close.
* Ndb::closeTransaction or NdbTransaction::close.
* The transaction must be closed independent of its outcome, i.e.
* even if there is an error.
*
......@@ -1180,9 +1182,9 @@ public:
* which node to run the Transaction Coordinator on
* @param keyLen Length of partition key expressed in bytes
*
* @return NdbConnection object, or NULL on failure.
* @return NdbTransaction object, or NULL on failure.
*/
NdbConnection* startTransaction(Uint32 prio = 0,
NdbTransaction* startTransaction(Uint32 prio = 0,
const char * keyData = 0,
Uint32 keyLen = 0);
......@@ -1213,9 +1215,9 @@ public:
* @param type is the type of distribution group.<br>
* 0 means direct usage of the two characters, and<br>
* 1 means the ASCII digit variant.
* @return NdbConnection, or NULL if it failed.
* @return NdbTransaction, or NULL if it failed.
*/
NdbConnection* startTransactionDGroup(Uint32 aPrio,
NdbTransaction* startTransactionDGroup(Uint32 aPrio,
const char * keyData, int type);
#endif
......@@ -1234,7 +1236,7 @@ public:
* has completed before calling Ndb::closeTransaction).
* If the transaction is not committed it will be aborted.
*/
void closeTransaction(NdbConnection* aConnection);
void closeTransaction(NdbTransaction*);
/** @} *********************************************************************/
......@@ -1420,7 +1422,7 @@ public:
/**
*/
NdbConnection* hupp( NdbConnection* );
NdbTransaction* hupp( NdbTransaction* );
Uint32 getReference() const { return theMyRef;}
#endif
......@@ -1435,11 +1437,11 @@ private:
void connected(Uint32 block_reference);
NdbConnection* startTransactionLocal(Uint32 aPrio, Uint32 aFragmentId);
NdbTransaction* startTransactionLocal(Uint32 aPrio, Uint32 aFragmentId);
// Connect the connection object to the Database.
int NDB_connect(Uint32 tNode);
NdbConnection* doConnect(Uint32 nodeId);
NdbTransaction* doConnect(Uint32 nodeId);
void doDisconnect();
NdbReceiver* getNdbScanRec();// Get a NdbScanReceiver from idle list
......@@ -1471,8 +1473,8 @@ private:
void check_send_timeout();
void remove_sent_list(Uint32);
Uint32 insert_completed_list(NdbConnection*);
Uint32 insert_sent_list(NdbConnection*);
Uint32 insert_completed_list(NdbTransaction*);
Uint32 insert_sent_list(NdbTransaction*);
// Handle a received signal. Used by both
// synchronous and asynchronous interface
......@@ -1512,20 +1514,20 @@ private:
void freeNdbScanRec(); // Free the first idle NdbScanRec obj
void freeNdbBlob(); // Free the first etc
NdbConnection* getNdbCon(); // Get a connection from idle list
NdbTransaction* getNdbCon(); // Get a connection from idle list
/**
* Get a connected NdbConnection to nodeId
* Get a connected NdbTransaction to nodeId
* Returns NULL if none found
*/
NdbConnection* getConnectedNdbConnection(Uint32 nodeId);
NdbTransaction* getConnectedNdbTransaction(Uint32 nodeId);
// Release and disconnect from DBTC a connection
// and seize it to theConIdleList
void releaseConnectToNdb (NdbConnection* aConnectConnection);
void releaseConnectToNdb (NdbTransaction*);
// Release a connection to idle list
void releaseNdbCon (NdbConnection* aConnection);
void releaseNdbCon (NdbTransaction*);
int checkInitState(); // Check that we are initialized
void report_node_failure(Uint32 node_id); // Report Failed node
......@@ -1535,15 +1537,15 @@ private:
int NDB_connect(); // Perform connect towards NDB Kernel
// Release arrays of NdbConnection pointers
// Release arrays of NdbTransaction pointers
void releaseTransactionArrays();
Uint32 pollCompleted(NdbConnection** aCopyArray);
Uint32 pollCompleted(NdbTransaction** aCopyArray);
void sendPrepTrans(int forceSend);
void reportCallback(NdbConnection** aCopyArray, Uint32 aNoOfComplTrans);
void reportCallback(NdbTransaction** aCopyArray, Uint32 aNoOfComplTrans);
void waitCompletedTransactions(int milliSecs, int noOfEventsToWaitFor);
void completedTransaction(NdbConnection* aTransaction);
void completedScanTransaction(NdbConnection* aTransaction);
void completedTransaction(NdbTransaction* aTransaction);
void completedScanTransaction(NdbTransaction* aTransaction);
void abortTransactionsAfterNodeFailure(Uint16 aNodeId);
......@@ -1565,7 +1567,7 @@ private:
void* int2void (Uint32 val);
NdbReceiver* void2rec (void* val);
NdbConnection* void2con (void* val);
NdbTransaction* void2con (void* val);
NdbOperation* void2rec_op (void* val);
NdbIndexOperation* void2rec_iop (void* val);
......@@ -1575,9 +1577,9 @@ private:
NdbObjectIdMap* theNdbObjectIdMap;
Ndb_cluster_connection *m_ndb_cluster_connection;
NdbConnection** thePreparedTransactionsArray;
NdbConnection** theSentTransactionsArray;
NdbConnection** theCompletedTransactionsArray;
NdbTransaction** thePreparedTransactionsArray;
NdbTransaction** theSentTransactionsArray;
NdbTransaction** theCompletedTransactionsArray;
Uint32 theNoOfPreparedTransactions;
Uint32 theNoOfSentTransactions;
......@@ -1603,14 +1605,14 @@ private:
class NdbDictionaryImpl* theDictionary;
class NdbGlobalEventBufferHandle* theGlobalEventBufferHandle;
NdbConnection* theConIdleList; // First connection in idle list.
NdbTransaction* theConIdleList; // First connection in idle list.
NdbOperation* theOpIdleList; // First operation in the idle list.
NdbIndexScanOperation* theScanOpIdleList; // First scan operation in the idle list.
NdbIndexOperation* theIndexOpIdleList; // First index operation in the idle list.
NdbConnection* theTransactionList;
NdbConnection** theConnectionArray;
NdbTransaction* theTransactionList;
NdbTransaction** theConnectionArray;
NdbRecAttr* theRecAttrIdleList;
NdbApiSignal* theSignalIdleList; // First signal in idlelist.
NdbLabel* theLabelList; // First label descriptor in list
......
......@@ -19,7 +19,7 @@
#include "ndbapi_limits.h"
#include "Ndb.hpp"
#include "NdbConnection.hpp"
#include "NdbTransaction.hpp"
#include "NdbOperation.hpp"
#include "NdbScanOperation.hpp"
#include "NdbIndexOperation.hpp"
......
......@@ -19,11 +19,11 @@
#include <ndb_types.h>
#include <NdbDictionary.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbError.hpp>
class Ndb;
class NdbConnection;
class NdbTransaction;
class NdbOperation;
class NdbRecAttr;
class NdbTableImpl;
......@@ -67,7 +67,7 @@ class NdbColumnImpl;
* cases NdbBlob is forced to do implicit executes. To avoid this,
* operate on complete blob parts.
*
* Use NdbConnection::executePendingBlobOps to flush your reads and
* Use NdbTransaction::executePendingBlobOps to flush your reads and
* writes. It avoids execute penalty if nothing is pending. It is not
* needed after execute (obviously) or after next scan result.
*
......@@ -212,12 +212,14 @@ public:
NdbBlob* blobsNextBlob();
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbDictionaryImpl;
friend class NdbResultSet; // atNextResult
#endif
// state
State theState;
void setState(State newState);
......@@ -226,7 +228,7 @@ private:
static void getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c);
// ndb api stuff
Ndb* theNdb;
NdbConnection* theNdbCon;
NdbTransaction* theNdbCon;
NdbOperation* theNdbOp;
const NdbTableImpl* theTable;
const NdbTableImpl* theAccessTable;
......@@ -316,7 +318,7 @@ private:
// callbacks
int invokeActiveHook();
// blob handle maintenance
int atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn);
int atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn);
int preExecute(ExecType anExecType, bool& batch);
int postExecute(ExecType anExecType);
int preCommit();
......@@ -324,7 +326,7 @@ private:
// errors
void setErrorCode(int anErrorCode, bool invalidFlag = true);
void setErrorCode(NdbOperation* anOp, bool invalidFlag = true);
void setErrorCode(NdbConnection* aCon, bool invalidFlag = true);
void setErrorCode(NdbTransaction* aCon, bool invalidFlag = true);
#ifdef VM_TRACE
int getOperationType() const;
friend class NdbOut& operator<<(NdbOut&, const NdbBlob&);
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NdbCursorOperation_H
#define NdbCursorOperation_H
#endif
......@@ -388,8 +388,10 @@ public:
#endif
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbRecAttr;
friend class NdbColumnImpl;
#endif
class NdbColumnImpl & m_impl;
Column(NdbColumnImpl&);
Column& operator=(const Column&);
......@@ -646,7 +648,9 @@ public:
#endif
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbTableImpl;
#endif
class NdbTableImpl & m_impl;
Table(NdbTableImpl&);
};
......@@ -798,8 +802,9 @@ public:
virtual int getObjectVersion() const;
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbIndexImpl;
#endif
class NdbIndexImpl & m_impl;
Index(NdbIndexImpl&);
};
......@@ -851,8 +856,10 @@ public:
void print();
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbEventImpl;
friend class NdbEventOperationImpl;
#endif
class NdbEventImpl & m_impl;
Event(NdbEventImpl&);
};
......@@ -1071,9 +1078,11 @@ public:
~Dictionary();
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbDictionaryImpl;
friend class UtilTransactions;
friend class NdbBlob;
#endif
class NdbDictionaryImpl & m_impl;
Dictionary(NdbDictionaryImpl&);
const Table * getIndexTable(const char * indexName,
......
......@@ -203,8 +203,10 @@ public:
void print();
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbEventOperationImpl;
friend class Ndb;
#endif
NdbEventOperation(Ndb *theNdb, const char* eventName,int bufferLength);
~NdbEventOperation();
static int wait(void *p, int aMillisecondNumber);
......
......@@ -14,18 +14,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbIndexOperation.hpp
* Include:
* Link:
* Author: Martin Sköld
* Date: 2002-04-01
* Version: 0.1
* Description: Secondary index support
* Documentation:
* Adjust: 2002-04-01 Martin Sköld First version.
****************************************************************************/
#ifndef NdbIndexOperation_H
#define NdbIndexOperation_H
......@@ -40,8 +28,10 @@ class NdbResultSet;
*/
class NdbIndexOperation : public NdbOperation
{
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
#endif
public:
/**
......@@ -54,16 +44,17 @@ public:
/**
* Define the NdbIndexOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* reads a tuple.
*
* @return 0 if successful otherwise -1.
*/
int readTuple(LockMode);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
* Define the NdbIndexOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* reads a tuple.
*
* @return 0 if successful otherwise -1.
......@@ -73,7 +64,7 @@ public:
/**
* Define the NdbIndexOperation to be a standard operation of type
* readTupleExclusive.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* read a tuple using an exclusive lock.
*
* @return 0 if successful otherwise -1.
......@@ -82,7 +73,7 @@ public:
/**
* Define the NdbIndexOperation to be a standard operation of type simpleRead.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* reads an existing tuple (using shared read lock),
* but releases lock immediately after read.
*
......@@ -101,7 +92,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type committedRead.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* read latest committed value of the record.
*
* This means that if another transaction is updating the
......@@ -113,7 +104,6 @@ public:
*/
int dirtyRead();
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
int committedRead();
#endif
......@@ -121,7 +111,7 @@ public:
* Define the NdbIndexOperation to be a standard operation of type
* updateTuple.
*
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* updates a tuple in the table.
*
* @return 0 if successful otherwise -1.
......@@ -132,7 +122,7 @@ public:
* Define the NdbIndexOperation to be a standard operation of type
* deleteTuple.
*
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* deletes a tuple.
*
* @return 0 if successful otherwise -1.
......@@ -143,7 +133,7 @@ public:
* Define the NdbIndexOperation to be a standard operation of type
* dirtyUpdate.
*
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* updates without two-phase commit.
*
* @return 0 if successful otherwise -1.
......@@ -181,7 +171,7 @@ private:
// Overloaded methods from NdbCursorOperation
int indxInit(const class NdbIndexImpl* anIndex,
const class NdbTableImpl* aTable,
NdbConnection* myConnection);
NdbTransaction*);
int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
......
......@@ -24,11 +24,14 @@
* @brief Class of scan operations for use to scan ordered index
*/
class NdbIndexScanOperation : public NdbScanOperation {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbResultSet;
friend class NdbOperation;
friend class NdbScanOperation;
#endif
public:
/**
* readTuples returns a NdbResultSet where tuples are stored.
......@@ -50,6 +53,7 @@ public:
bool order_desc = false,
bool read_range_no = false);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
inline int readTuples(int parallell){
return readTuples(LM_Read, 0, parallell, false);
}
......@@ -57,6 +61,7 @@ public:
inline int readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell, false);
}
#endif
/**
* Type of ordered index key bound. The values (0-4) will not change
......
......@@ -27,7 +27,7 @@ class Ndb;
class NdbApiSignal;
class NdbRecAttr;
class NdbOperation;
class NdbConnection;
class NdbTransaction;
class NdbColumnImpl;
class NdbBlob;
......@@ -37,14 +37,17 @@ class NdbBlob;
*/
class NdbOperation
{
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbScanOperation;
friend class NdbScanReceiver;
friend class NdbScanFilter;
friend class NdbScanFilterImpl;
friend class NdbReceiver;
friend class NdbBlob;
#endif
public:
/**
* @name Define Standard Operation Type
......@@ -66,7 +69,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type insertTuple.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* adds a new tuple to the table.
*
* @return 0 if successful otherwise -1.
......@@ -75,7 +78,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type updateTuple.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* updates a tuple in the table.
*
* @return 0 if successful otherwise -1.
......@@ -84,7 +87,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type writeTuple.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* writes a tuple to the table.
* If the tuple exists, it updates it, otherwise an insert takes place.
*
......@@ -94,7 +97,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type deleteTuple.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* delete a tuple.
*
* @return 0 if successful otherwise -1.
......@@ -103,7 +106,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* reads a tuple.
*
* @return 0 if successful otherwise -1.
......@@ -112,17 +115,18 @@ public:
/**
* Define the NdbOperation to be a standard operation of type readTuple.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* reads a tuple.
*
* @return 0 if successful otherwise -1.
*/
virtual int readTuple();
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
* Define the NdbOperation to be a standard operation of type
* readTupleExclusive.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* read a tuple using an exclusive lock.
*
* @return 0 if successful otherwise -1.
......@@ -132,7 +136,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type
* simpleRead.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* reads an existing tuple (using shared read lock),
* but releases lock immediately after read.
*
......@@ -149,10 +153,9 @@ public:
*/
virtual int simpleRead();
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
* Define the NdbOperation to be a standard operation of type committedRead.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* read latest committed value of the record.
*
* This means that if another transaction is updating the
......@@ -169,7 +172,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type committedRead.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* read latest committed value of the record.
*
* This means that if another transaction is updating the
......@@ -183,7 +186,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type dirtyUpdate.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* updates without two-phase commit.
*
* @return 0 if successful otherwise -1.
......@@ -192,7 +195,7 @@ public:
/**
* Define the NdbOperation to be a standard operation of type dirtyWrite.
* When calling NdbConnection::execute, this operation
* When calling NdbTransaction::execute, this operation
* writes without two-phase commit.
*
* @return 0 if successful otherwise -1.
......@@ -301,7 +304,7 @@ public:
* @note This method does not fetch the attribute value from
* the database! The NdbRecAttr object returned by this method
* is <em>not</em> readable/printable before the
* transaction has been executed with NdbConnection::execute.
* transaction has been executed with NdbTransaction::execute.
*
* @param anAttrName Attribute name
* @param aValue If this is non-NULL, then the attribute value
......@@ -743,7 +746,7 @@ protected:
//--------------------------------------------------------------
// Initialise after allocating operation to a transaction
//--------------------------------------------------------------
int init(const class NdbTableImpl*, NdbConnection* aCon);
int init(const class NdbTableImpl*, NdbTransaction* aCon);
void initInterpreter();
void next(NdbOperation*); // Set next pointer
......@@ -775,7 +778,7 @@ protected:
void Status(OperationStatus); // Set the status information
void NdbCon(NdbConnection*); // Set reference to connection
void NdbCon(NdbTransaction*); // Set reference to connection
// object.
virtual void release(); // Release all operations
......@@ -812,7 +815,7 @@ protected:
virtual int equal_impl(const NdbColumnImpl*,const char* aValue, Uint32 len);
virtual NdbRecAttr* getValue_impl(const NdbColumnImpl*, char* aValue = 0);
int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len);
NdbBlob* getBlobHandle(NdbConnection* aCon, const NdbColumnImpl* anAttrObject);
NdbBlob* getBlobHandle(NdbTransaction* aCon, const NdbColumnImpl* anAttrObject);
int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue);
int subValue(const NdbColumnImpl* anAttrObject, Uint32 aValue);
......@@ -861,7 +864,7 @@ protected:
int theErrorLine; // Error line
Ndb* theNdb; // Point back to the Ndb object.
NdbConnection* theNdbCon; // Point back to the connection object.
NdbTransaction* theNdbCon; // Point back to the connection object.
NdbOperation* theNext; // Next pointer to operation.
union {
......@@ -1043,14 +1046,14 @@ NdbOperation::Status( OperationStatus aStatus )
}
/******************************************************************************
void NdbCon(NdbConnection* aNdbCon);
void NdbCon(NdbTransaction* aNdbCon);
Parameters: aNdbCon: Pointers to NdbConnection object.
Parameters: aNdbCon: Pointers to NdbTransaction object.
Remark: Set the reference to the connection in the operation object.
******************************************************************************/
inline
void
NdbOperation::NdbCon(NdbConnection* aNdbCon)
NdbOperation::NdbCon(NdbTransaction* aNdbCon)
{
theNdbCon = aNdbCon;
}
......
......@@ -34,7 +34,7 @@ class NdbOperation;
* MyRecAttr = MyOperation->getValue("ATTR2", NULL);
* if (MyRecAttr == NULL) goto error;
*
* if (MyConnection->execute(Commit) == -1) goto error;
* if (MyTransaction->execute(Commit) == -1) goto error;
*
* ndbout << MyRecAttr->u_32_value();
* @endcode
......@@ -43,14 +43,14 @@ class NdbOperation;
* @ref ndbapi_example2.cpp.
*
* @note The NdbRecAttr object is instantiated with its value when
* NdbConnection::execute is called. Before this, the value is
* NdbTransaction::execute is called. Before this, the value is
* undefined. (NdbRecAttr::isNULL can be used to check
* if the value is defined or not.)
* This means that an NdbRecAttr object only has valid information
* between the time of calling NdbConnection::execute and
* between the time of calling NdbTransaction::execute and
* the time of Ndb::closeTransaction.
* The value of the null indicator is -1 until the
* NdbConnection::execute method have been called.
* NdbTransaction::execute method have been called.
*
* For simple types, there are methods which directly getting the value
* from the NdbRecAttr object.
......@@ -72,12 +72,14 @@ class NdbOperation;
*/
class NdbRecAttr
{
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbOperation;
friend class NdbIndexScanOperation;
friend class NdbEventOperationImpl;
friend class NdbReceiver;
friend class Ndb;
friend class NdbOut& operator<<(class NdbOut&, const class AttributeS&);
#endif
public:
/**
......@@ -124,7 +126,7 @@ public:
* Check if attribute value is NULL.
*
* @return -1 = Not defined (Failure or
* NdbConnection::execute not yet called).<br>
* NdbTransaction::execute not yet called).<br>
* 0 = Attribute value is defined, but not equal to NULL.<br>
* 1 = Attribute value is defined and equal to NULL.
*/
......
......@@ -22,16 +22,18 @@
#include <ndb_global.h>
class Ndb;
class NdbConnection;
class NdbTransaction;
class NdbReceiver
{
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbIndexOperation;
friend class NdbIndexScanOperation;
friend class NdbConnection;
friend class NdbTransaction;
#endif
public:
enum ReceiverType { NDB_UNINITIALIZED,
NDB_OPERATION = 1,
......@@ -52,7 +54,7 @@ public:
return m_type;
}
inline NdbConnection * getTransaction();
inline NdbTransaction * getTransaction();
void* getOwner(){
return m_owner;
}
......
......@@ -169,7 +169,9 @@ public:
/** @} *********************************************************************/
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class NdbScanFilterImpl;
#endif
class NdbScanFilterImpl & m_impl;
NdbScanFilter& operator=(const NdbScanFilter&); ///< Defined not implemented
};
......
......@@ -39,11 +39,14 @@ class NdbResultSet;
* @brief Class of scan operations for use in transactions.
*/
class NdbScanOperation : public NdbOperation {
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbResultSet;
friend class NdbOperation;
friend class NdbBlob;
#endif
public:
/**
* readTuples returns a NdbResultSet where tuples are stored.
......@@ -58,6 +61,7 @@ public:
int readTuples(LockMode = LM_Read,
Uint32 batch = 0, Uint32 parallel = 0);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
inline int readTuples(int parallell){
return readTuples(LM_Read, 0, parallell);
}
......@@ -65,9 +69,12 @@ public:
inline int readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell);
}
#endif
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
NdbBlob* getBlobHandle(const char* anAttrName);
NdbBlob* getBlobHandle(Uint32 anAttrId);
#endif
/**
* Get the next tuple in a scan transaction.
......@@ -145,7 +152,7 @@ public:
* @return an NdbOperation or NULL.
*/
NdbOperation* updateCurrentTuple();
NdbOperation* updateCurrentTuple(NdbConnection* updateTrans);
NdbOperation* updateCurrentTuple(NdbTransaction* updateTrans);
/**
* Transfer scan operation to a deleting transaction. Use this function
......@@ -164,7 +171,7 @@ public:
* @return an NdbOperation or NULL.
*/
int deleteCurrentTuple();
int deleteCurrentTuple(NdbConnection* takeOverTransaction);
int deleteCurrentTuple(NdbTransaction* takeOverTransaction);
protected:
NdbScanOperation(Ndb* aNdb);
......@@ -179,7 +186,7 @@ protected:
int executeCursor(int ProcessorId);
// Overloaded private methods from NdbOperation
int init(const NdbTableImpl* tab, NdbConnection* myConnection);
int init(const NdbTableImpl* tab, NdbTransaction*);
int prepareSend(Uint32 TC_ConnectPtr, Uint64 TransactionId);
int doSend(int ProcessorId);
void checkForceSend(bool forceSend);
......@@ -187,7 +194,7 @@ protected:
virtual void setErrorCode(int aErrorCode);
virtual void setErrorCodeAbort(int aErrorCode);
NdbConnection *m_transConnection;
NdbTransaction *m_transConnection;
// Scan related variables
Uint32 theParallelism;
......@@ -230,7 +237,7 @@ protected:
void execCLOSE_SCAN_REP();
int getKeyFromKEYINFO20(Uint32* data, unsigned size);
NdbOperation* takeOverScanOp(OperationType opType, NdbConnection*);
NdbOperation* takeOverScanOp(OperationType opType, NdbTransaction*);
bool m_ordered;
bool m_descending;
......@@ -245,7 +252,7 @@ NdbScanOperation::updateCurrentTuple(){
inline
NdbOperation*
NdbScanOperation::updateCurrentTuple(NdbConnection* takeOverTrans){
NdbScanOperation::updateCurrentTuple(NdbTransaction* takeOverTrans){
return takeOverScanOp(NdbOperation::UpdateRequest,
takeOverTrans);
}
......@@ -258,7 +265,7 @@ NdbScanOperation::deleteCurrentTuple(){
inline
int
NdbScanOperation::deleteCurrentTuple(NdbConnection * takeOverTrans){
NdbScanOperation::deleteCurrentTuple(NdbTransaction * takeOverTrans){
void * res = takeOverScanOp(NdbOperation::DeleteRequest,
takeOverTrans);
if(res == 0)
......
......@@ -14,14 +14,14 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NdbConnection_H
#define NdbConnection_H
#ifndef NdbTransaction_H
#define NdbTransaction_H
#include <ndb_types.h>
#include <NdbError.hpp>
#include <NdbDictionary.hpp>
class NdbConnection;
class NdbTransaction;
class NdbOperation;
class NdbScanOperation;
class NdbIndexScanOperation;
......@@ -30,17 +30,16 @@ class NdbApiSignal;
class Ndb;
class NdbBlob;
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
// to be documented later
/**
* NdbAsynchCallback functions are used when executing asynchronous
* transactions (using NdbConnection::executeAsynchPrepare, or
* NdbConnection::executeAsynch).
* transactions (using NdbTransaction::executeAsynchPrepare, or
* NdbTransaction::executeAsynch).
* The functions are called when the execute has finished.
* See @ref secAsync for more information.
*/
typedef void (* NdbAsynchCallback)(int, NdbConnection*, void*);
typedef void (* NdbAsynchCallback)(int, NdbTransaction*, void*);
#endif
/**
......@@ -73,37 +72,37 @@ enum ExecType {
/**
* @class NdbConnection
* @class NdbTransaction
* @brief Represents a transaction.
*
* A transaction (represented by an NdbConnection object)
* A transaction (represented by an NdbTransaction object)
* belongs to an Ndb object and is typically created using
* Ndb::startTransaction.
* A transaction consists of a list of operations
* (represented by NdbOperation objects).
* Each operation access exactly one table.
*
* After getting the NdbConnection object,
* After getting the NdbTransaction object,
* the first step is to get (allocate) an operation given the table name.
* Then the operation is defined.
* Several operations can be defined in parallel on the same
* NdbConnection object.
* When all operations are defined, the NdbConnection::execute
* NdbTransaction object.
* When all operations are defined, the NdbTransaction::execute
* method sends them to the NDB kernel for execution.
*
* The NdbConnection::execute method returns when the NDB kernel has
* The NdbTransaction::execute method returns when the NDB kernel has
* completed execution of all operations defined before the call to
* NdbConnection::execute.
* NdbTransaction::execute.
* All allocated operations should be properly defined
* before calling NdbConnection::execute.
* before calling NdbTransaction::execute.
*
* A call to NdbConnection::execute uses one out of three types of execution:
* A call to NdbTransaction::execute uses one out of three types of execution:
* -# ExecType::NoCommit Executes operations without committing them.
* -# ExecType::Commit Executes remaining operation and commits the
* complete transaction
* -# ExecType::Rollback Rollbacks the entire transaction.
*
* NdbConnection::execute is equipped with an extra error handling parameter
* NdbTransaction::execute is equipped with an extra error handling parameter
* There are two alternatives:
* -# AbortOption::AbortOnError (default).
* The transaction is aborted if there are any error during the
......@@ -111,28 +110,28 @@ enum ExecType {
* -# AbortOption::IgnoreError
* Continue execution of transaction even if operation fails
*
* NdbConnection::execute can sometimes indicate an error
* (return with -1) while the error code on the NdbConnection is 0.
* NdbTransaction::execute can sometimes indicate an error
* (return with -1) while the error code on the NdbTransaction is 0.
* This is an indication that one of the operations found a record
* problem. The transaction is still ok and can continue as usual.
* The NdbConnection::execute returns -1 together with error code
* on NdbConnection object equal to 0 always means that an
* The NdbTransaction::execute returns -1 together with error code
* on NdbTransaction object equal to 0 always means that an
* operation was not successful but that the total transaction was OK.
* By checking error codes on the individual operations it is possible
* to find out which operation was not successful.
*
* NdbConnection::executeScan is used to setup a scan in the NDB kernel
* NdbTransaction::executeScan is used to setup a scan in the NDB kernel
* after it has been defined.
* NdbConnection::nextScanResult is used to iterate through the
* NdbTransaction::nextScanResult is used to iterate through the
* scanned tuples.
* After each call to NdbConnection::nextScanResult, the pointers
* After each call to NdbTransaction::nextScanResult, the pointers
* of NdbRecAttr objects defined in the NdbOperation::getValue
* operations are updated with the values of the new the scanned tuple.
*/
/* FUTURE IMPLEMENTATION:
* Later a prepare mode will be added when Ndb supports Prepare-To-Commit
* The NdbConnection can deliver the Transaction Id of the transaction.
* The NdbTransaction can deliver the Transaction Id of the transaction.
* After committing a transaction it is also possible to retrieve the
* global transaction checkpoint which the transaction was put in.
*
......@@ -151,20 +150,22 @@ enum ExecType {
* not known the table of the tuple. As long as the table is
* derived from the known base class everything is ok.
* It is not possible to provide any primary key since it is
* already supplied with the call to NdbConnection::getNdbOperation.
* already supplied with the call to NdbTransaction::getNdbOperation.
* -# The third method is used when a scanned tuple is to be transferred to
* another transaction. In this case it is not possible to define the
* primary key since it came along from the scanned tuple.
*
*/
class NdbConnection
class NdbTransaction
{
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
friend class Ndb;
friend class NdbOperation;
friend class NdbScanOperation;
friend class NdbIndexOperation;
friend class NdbIndexScanOperation;
friend class NdbBlob;
#endif
public:
......@@ -195,7 +196,7 @@ public:
/**
* Get an operation from NdbScanOperation idlelist and
* get the NdbConnection object which
* get the NdbTransaction object which
* was fetched by startTransaction pointing to this operation.
*
* @param aTableName The table name.
......@@ -205,7 +206,7 @@ public:
/**
* Get an operation from NdbScanOperation idlelist and
* get the NdbConnection object which
* get the NdbTransaction object which
* was fetched by startTransaction pointing to this operation.
*
* @param aTable
......@@ -216,7 +217,7 @@ public:
/**
* Get an operation from NdbIndexScanOperation idlelist and
* get the NdbConnection object which
* get the NdbTransaction object which
* was fetched by startTransaction pointing to this operation.
*
* @param anIndexName The index name.
......@@ -228,7 +229,7 @@ public:
/**
* Get an operation from NdbIndexScanOperation idlelist and
* get the NdbConnection object which
* get the NdbTransaction object which
* was fetched by startTransaction pointing to this operation.
*
* @param anIndex
......@@ -243,7 +244,7 @@ public:
/**
* Get an operation from NdbIndexOperation idlelist and
* get the NdbConnection object that
* get the NdbTransaction object that
* was fetched by startTransaction pointing to this operation.
*
* @param anIndexName The index name (as created by createIndex).
......@@ -256,7 +257,7 @@ public:
/**
* Get an operation from NdbIndexOperation idlelist and
* get the NdbConnection object that
* get the NdbTransaction object that
* was fetched by startTransaction pointing to this operation.
*
* @param anIndex
......@@ -333,10 +334,10 @@ public:
* Prepare and send an asynchronous transaction.
*
* This method perform the same action as
* NdbConnection::executeAsynchPrepare
* NdbTransaction::executeAsynchPrepare
* but also sends the operations to the NDB kernel.
*
* See NdbConnection::executeAsynchPrepare for information
* See NdbTransaction::executeAsynchPrepare for information
* about the parameters of this method.
*
* See @ref secAsync for more information on
......@@ -361,12 +362,12 @@ public:
/**
* Close transaction
* @note It is not allowed to call NdbConnection::close after sending the
* @note It is not allowed to call NdbTransaction::close after sending the
* transaction asynchronously before the callback method has
* been called.
* (The application should keep track of the number of
* outstanding transactions and wait until all of them
* has completed before calling NdbConnection::close).
* has completed before calling NdbTransaction::close).
* If the transaction is not committed it will be aborted.
*/
void close();
......@@ -406,7 +407,7 @@ public:
* (This is because no updates are performed in scan transactions.)
*
* @return GCI of transaction or -1 if GCI is not available.
* (Note that there has to be an NdbConnection::execute call
* (Note that there has to be an NdbTransaction::execute call
* with Ndb::Commit for the GCI to be available.)
*/
int getGCI();
......@@ -450,7 +451,7 @@ public:
/**
* Get the latest NdbOperation which had an error.
* This method is used on the NdbConnection object to find the
* This method is used on the NdbTransaction object to find the
* NdbOperation causing an error.
* To find more information about the
* actual error, use method NdbOperation::getNdbError
......@@ -472,9 +473,9 @@ public:
*
* This method should only be used <em>after</em> a transaction
* has been executed.
* - NdbConnection::getNextCompletedOperation(NULL) returns the
* - NdbTransaction::getNextCompletedOperation(NULL) returns the
* first NdbOperation object.
* - NdbConnection::getNextCompletedOperation(op) returns the
* - NdbTransaction::getNextCompletedOperation(op) returns the
* NdbOperation object defined after the NdbOperation "op".
*
* This method is typically used to fetch all NdbOperation:s of
......@@ -519,9 +520,9 @@ private:
* These are the create and delete methods of this class. *
**************************************************************************/
NdbConnection(Ndb* aNdb);
NdbTransaction(Ndb* aNdb);
~NdbConnection();
~NdbTransaction();
void init(); // Initialize connection object for new transaction
......@@ -541,8 +542,8 @@ private:
int getTC_ConnectPtr(); // Gets TC Connect pointer
void setBuddyConPtr(Uint32); // Sets Buddy Con Ptr
Uint32 getBuddyConPtr(); // Gets Buddy Con Ptr
NdbConnection* next(); // Returns the next pointer
void next(NdbConnection*); // Sets the next pointer
NdbTransaction* next(); // Returns the next pointer
void next(NdbTransaction*); // Sets the next pointer
enum ConStatusType {
NotConnected,
......@@ -653,7 +654,7 @@ private:
NdbOperation* theErrorOperation; // The NdbOperation where the error occurred
Ndb* theNdb; // Pointer to Ndb object
NdbConnection* theNext; // Next pointer. Used in idle list.
NdbTransaction* theNext; // Next pointer. Used in idle list.
NdbOperation* theFirstOpInList; // First operation in defining list.
NdbOperation* theLastOpInList; // Last operation in defining list.
......@@ -746,14 +747,14 @@ private:
inline
Uint32
NdbConnection::get_send_size()
NdbTransaction::get_send_size()
{
return 0;
}
inline
void
NdbConnection::set_send_size(Uint32 send_size)
NdbTransaction::set_send_size(Uint32 send_size)
{
return;
}
......@@ -764,7 +765,7 @@ NdbConnection::set_send_size(Uint32 send_size)
inline
int
NdbConnection::checkMagicNumber()
NdbTransaction::checkMagicNumber()
{
if (theMagicNumber == 0x37412619)
return 0;
......@@ -778,7 +779,7 @@ NdbConnection::checkMagicNumber()
inline
bool
NdbConnection::checkState_TransId(const Uint32 * transId) const {
NdbTransaction::checkState_TransId(const Uint32 * transId) const {
const Uint32 tTmp1 = transId[0];
const Uint32 tTmp2 = transId[1];
Uint64 tRecTransId = (Uint64)tTmp1 + ((Uint64)tTmp2 << 32);
......@@ -793,14 +794,14 @@ Remark: Set the transaction identity.
************************************************************************************************/
inline
void
NdbConnection::setTransactionId(Uint64 aTransactionId)
NdbTransaction::setTransactionId(Uint64 aTransactionId)
{
theTransactionId = aTransactionId;
}
inline
void
NdbConnection::setConnectedNodeId(Uint32 aNode, Uint32 aSequenceNo)
NdbTransaction::setConnectedNodeId(Uint32 aNode, Uint32 aSequenceNo)
{
theDBnode = aNode;
theNodeSequence = aSequenceNo;
......@@ -813,7 +814,7 @@ Remark: Get Connected node id.
******************************************************************************/
inline
Uint32
NdbConnection::getConnectedNodeId()
NdbTransaction::getConnectedNodeId()
{
return theDBnode;
}
......@@ -825,7 +826,7 @@ Remark: Set my block refrerence.
******************************************************************************/
inline
void
NdbConnection::setMyBlockReference(int aBlockRef)
NdbTransaction::setMyBlockReference(int aBlockRef)
{
theMyRef = aBlockRef;
}
......@@ -837,7 +838,7 @@ Remark: Sets TC Connect pointer.
******************************************************************************/
inline
void
NdbConnection::setTC_ConnectPtr(Uint32 aTCConPtr)
NdbTransaction::setTC_ConnectPtr(Uint32 aTCConPtr)
{
theTCConPtr = aTCConPtr;
}
......@@ -850,61 +851,61 @@ Remark: Gets TC Connect pointer.
******************************************************************************/
inline
int
NdbConnection::getTC_ConnectPtr()
NdbTransaction::getTC_ConnectPtr()
{
return theTCConPtr;
}
inline
void
NdbConnection::setBuddyConPtr(Uint32 aBuddyConPtr)
NdbTransaction::setBuddyConPtr(Uint32 aBuddyConPtr)
{
theBuddyConPtr = aBuddyConPtr;
}
inline
Uint32 NdbConnection::getBuddyConPtr()
Uint32 NdbTransaction::getBuddyConPtr()
{
return theBuddyConPtr;
}
/******************************************************************************
NdbConnection* next();
NdbTransaction* next();
inline
void
NdbConnection::setBuddyConPtr(Uint32 aBuddyConPtr)
NdbTransaction::setBuddyConPtr(Uint32 aBuddyConPtr)
{
theBuddyConPtr = aBuddyConPtr;
}
inline
Uint32 NdbConnection::getBuddyConPtr()
Uint32 NdbTransaction::getBuddyConPtr()
{
return theBuddyConPtr;
}
Return Value: Return next pointer to NdbConnection object.
Return Value: Return next pointer to NdbTransaction object.
Remark: Get the next pointer.
******************************************************************************/
inline
NdbConnection*
NdbConnection::next()
NdbTransaction*
NdbTransaction::next()
{
return theNext;
}
/******************************************************************************
void next(NdbConnection aConnection);
void next(NdbTransaction aTransaction);
Parameters: aConnection: The connection object.
Parameters: aTransaction: The connection object.
Remark: Sets the next pointer.
******************************************************************************/
inline
void
NdbConnection::next(NdbConnection* aConnection)
NdbTransaction::next(NdbTransaction* aTransaction)
{
theNext = aConnection;
theNext = aTransaction;
}
/******************************************************************************
......@@ -915,8 +916,8 @@ Parameters: aStatus: The status.
Remark: Sets Connect status.
******************************************************************************/
inline
NdbConnection::ConStatusType
NdbConnection::Status()
NdbTransaction::ConStatusType
NdbTransaction::Status()
{
return theStatus;
}
......@@ -929,7 +930,7 @@ Remark: Sets Connect status.
******************************************************************************/
inline
void
NdbConnection::Status( ConStatusType aStatus )
NdbTransaction::Status( ConStatusType aStatus )
{
theStatus = aStatus;
}
......@@ -942,7 +943,7 @@ Remark: Set global checkpoint identity of the transaction
******************************************************************************/
inline
void
NdbConnection::setGCI(int aGlobalCheckpointId)
NdbTransaction::setGCI(int aGlobalCheckpointId)
{
theGlobalCheckpointId = aGlobalCheckpointId;
}
......@@ -954,7 +955,7 @@ Remark: An operation was sent with success that expects a response.
******************************************************************************/
inline
void
NdbConnection::OpSent()
NdbTransaction::OpSent()
{
theNoOfOpSent++;
}
......@@ -965,7 +966,7 @@ void executePendingBlobOps();
#include <stdlib.h>
inline
int
NdbConnection::executePendingBlobOps(Uint8 flags)
NdbTransaction::executePendingBlobOps(Uint8 flags)
{
if (thePendingBlobOps & flags) {
// not executeNoBlobs because there can be new ops with blobs
......@@ -976,8 +977,10 @@ NdbConnection::executePendingBlobOps(Uint8 flags)
inline
Uint32
NdbConnection::ptr2int(){
NdbTransaction::ptr2int(){
return theId;
}
typedef NdbTransaction NdbConnection;
#endif
......@@ -14,8 +14,8 @@ libndbapi_la_SOURCES = \
Ndberr.cpp \
ndberror.c \
NdbErrorOut.cpp \
NdbConnection.cpp \
NdbConnectionScan.cpp \
NdbTransaction.cpp \
NdbTransactionScan.cpp \
NdbOperation.cpp \
NdbOperationSearch.cpp \
NdbOperationScan.cpp \
......
......@@ -27,7 +27,7 @@ Name: Ndb.cpp
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
#include <NdbOperation.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbEventOperation.hpp>
#include <NdbRecAttr.hpp>
#include <md5_hash.hpp>
......@@ -43,7 +43,7 @@ void connect();
Connect to any node which has no connection at the moment.
****************************************************************************/
NdbConnection* Ndb::doConnect(Uint32 tConNode)
NdbTransaction* Ndb::doConnect(Uint32 tConNode)
{
Uint32 tNode;
Uint32 i = 0;;
......@@ -56,7 +56,7 @@ NdbConnection* Ndb::doConnect(Uint32 tConNode)
//****************************************************************************
// We have connections now to the desired node. Return
//****************************************************************************
return getConnectedNdbConnection(tConNode);
return getConnectedNdbTransaction(tConNode);
} else if (TretCode != 0) {
tAnyAlive = 1;
}//if
......@@ -91,7 +91,7 @@ NdbConnection* Ndb::doConnect(Uint32 tConNode)
theCurrentConnectCounter = 2;
theCurrentConnectIndex = i;
}//if
return getConnectedNdbConnection(tNode);
return getConnectedNdbTransaction(tNode);
} else if (TretCode != 0) {
tAnyAlive = 1;
}//if
......@@ -127,12 +127,12 @@ Ndb::NDB_connect(Uint32 tNode)
return 0;
}
NdbConnection * tConArray = theConnectionArray[tNode];
NdbTransaction * tConArray = theConnectionArray[tNode];
if (tConArray != NULL) {
return 2;
}
NdbConnection * tNdbCon = getNdbCon(); // Get free connection object.
NdbTransaction * tNdbCon = getNdbCon(); // Get free connection object.
if (tNdbCon == NULL) {
return 4;
}//if
......@@ -148,10 +148,10 @@ Ndb::NDB_connect(Uint32 tNode)
}//if
tSignal->setData(tNdbCon->ptr2int(), 1);
//************************************************
// Set connection pointer as NdbConnection object
// Set connection pointer as NdbTransaction object
//************************************************
tSignal->setData(theMyRef, 2); // Set my block reference
tNdbCon->Status(NdbConnection::Connecting); // Set status to connecting
tNdbCon->Status(NdbTransaction::Connecting); // Set status to connecting
Uint32 nodeSequence;
{ // send and receive signal
Guard guard(tp->theMutexPtr);
......@@ -170,11 +170,11 @@ Ndb::NDB_connect(Uint32 tNode)
tReturnCode = -1;
}//if
}
if ((tReturnCode == 0) && (tNdbCon->Status() == NdbConnection::Connected)) {
if ((tReturnCode == 0) && (tNdbCon->Status() == NdbTransaction::Connected)) {
//************************************************
// Send and receive was successful
//************************************************
NdbConnection* tPrevFirst = theConnectionArray[tNode];
NdbTransaction* tPrevFirst = theConnectionArray[tNode];
tNdbCon->setConnectedNodeId(tNode, nodeSequence);
tNdbCon->setMyBlockReference(theMyRef);
......@@ -190,14 +190,14 @@ Ndb::NDB_connect(Uint32 tNode)
}//if
}//Ndb::NDB_connect()
NdbConnection *
Ndb::getConnectedNdbConnection(Uint32 nodeId){
NdbConnection* next = theConnectionArray[nodeId];
NdbTransaction *
Ndb::getConnectedNdbTransaction(Uint32 nodeId){
NdbTransaction* next = theConnectionArray[nodeId];
theConnectionArray[nodeId] = next->theNext;
next->theNext = NULL;
return next;
}//Ndb::getConnectedNdbConnection()
}//Ndb::getConnectedNdbTransaction()
/*****************************************************************************
disconnect();
......@@ -208,7 +208,7 @@ void
Ndb::doDisconnect()
{
DBUG_ENTER("Ndb::doDisconnect");
NdbConnection* tNdbCon;
NdbTransaction* tNdbCon;
CHECK_STATUS_MACRO_VOID;
DBUG_PRINT("info", ("theNoOfDBnodes=%d", theNoOfDBnodes));
......@@ -218,14 +218,14 @@ Ndb::doDisconnect()
Uint32 tNode = theDBnodes[i];
tNdbCon = theConnectionArray[tNode];
while (tNdbCon != NULL) {
NdbConnection* tmpNdbCon = tNdbCon;
NdbTransaction* tmpNdbCon = tNdbCon;
tNdbCon = tNdbCon->theNext;
releaseConnectToNdb(tmpNdbCon);
}//while
}//for
tNdbCon = theTransactionList;
while (tNdbCon != NULL) {
NdbConnection* tmpNdbCon = tNdbCon;
NdbTransaction* tmpNdbCon = tNdbCon;
tNdbCon = tNdbCon->theNext;
releaseConnectToNdb(tmpNdbCon);
}//while
......@@ -301,13 +301,13 @@ Ndb::waitUntilReady(int timeout)
}
/*****************************************************************************
NdbConnection* startTransaction();
NdbTransaction* startTransaction();
Return Value: Returns a pointer to a connection object.
Return NULL otherwise.
Remark: Start transaction. Synchronous.
*****************************************************************************/
NdbConnection*
NdbTransaction*
Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen)
{
DBUG_ENTER("Ndb::startTransaction");
......@@ -328,7 +328,7 @@ Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen)
nodeId = 0;
}//if
{
NdbConnection *trans= startTransactionLocal(aPriority, nodeId);
NdbTransaction *trans= startTransactionLocal(aPriority, nodeId);
DBUG_PRINT("exit",("start trans: 0x%x transid: 0x%llx",
trans, trans ? trans->getTransactionId() : 0));
DBUG_RETURN(trans);
......@@ -339,15 +339,15 @@ Ndb::startTransaction(Uint32 aPriority, const char * keyData, Uint32 keyLen)
}//Ndb::startTransaction()
/*****************************************************************************
NdbConnection* hupp(NdbConnection* pBuddyTrans);
NdbTransaction* hupp(NdbTransaction* pBuddyTrans);
Return Value: Returns a pointer to a connection object.
Connected to the same node as pBuddyTrans
and also using the same transction id
Remark: Start transaction. Synchronous.
*****************************************************************************/
NdbConnection*
Ndb::hupp(NdbConnection* pBuddyTrans)
NdbTransaction*
Ndb::hupp(NdbTransaction* pBuddyTrans)
{
DBUG_ENTER("Ndb::hupp");
......@@ -363,7 +363,7 @@ Ndb::hupp(NdbConnection* pBuddyTrans)
checkFailedNode();
Uint32 nodeId = pBuddyTrans->getConnectedNodeId();
NdbConnection* pCon = startTransactionLocal(aPriority, nodeId);
NdbTransaction* pCon = startTransactionLocal(aPriority, nodeId);
if(pCon == NULL)
DBUG_RETURN(NULL);
......@@ -384,7 +384,7 @@ Ndb::hupp(NdbConnection* pBuddyTrans)
}//if
}//Ndb::hupp()
NdbConnection*
NdbTransaction*
Ndb::startTransactionDGroup(Uint32 aPriority, const char * keyData, int type)
{
......@@ -414,7 +414,7 @@ Ndb::startTransactionDGroup(Uint32 aPriority, const char * keyData, int type)
fragmentId = getFragmentId(hashValue);
}//if
Uint32 nodeId = guessPrimaryNode(fragmentId);
NdbConnection* trans= startTransactionLocal(aPriority, nodeId);
NdbTransaction* trans= startTransactionLocal(aPriority, nodeId);
DBUG_PRINT("exit", ("start DGroup trans: 0x%x transid: 0x%llx",
trans, trans ? trans->getTransactionId() : 0));
return trans;
......@@ -423,7 +423,7 @@ Ndb::startTransactionDGroup(Uint32 aPriority, const char * keyData, int type)
}//if
}//Ndb::startTransaction()
NdbConnection*
NdbTransaction*
Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId)
{
#ifdef VM_TRACE
......@@ -437,13 +437,13 @@ Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId)
DBUG_ENTER("Ndb::startTransactionLocal");
DBUG_PRINT("enter", ("nodeid: %d", nodeId));
NdbConnection* tConnection;
NdbTransaction* tConnection;
Uint64 tFirstTransId = theFirstTransId;
tConnection = doConnect(nodeId);
if (tConnection == NULL) {
DBUG_RETURN(NULL);
}//if
NdbConnection* tConNext = theTransactionList;
NdbTransaction* tConNext = theTransactionList;
tConnection->init();
theTransactionList = tConnection; // into a transaction list.
tConnection->next(tConNext); // Add the active connection object
......@@ -459,7 +459,7 @@ Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId)
theFirstTransId = tFirstTransId + 1;
}//if
#ifdef VM_TRACE
if (tConnection->theListState != NdbConnection::NotInList) {
if (tConnection->theListState != NdbTransaction::NotInList) {
printState("startTransactionLocal %x", tConnection);
abort();
}
......@@ -468,17 +468,17 @@ Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId)
}//Ndb::startTransactionLocal()
/*****************************************************************************
void closeTransaction(NdbConnection* aConnection);
void closeTransaction(NdbTransaction* aConnection);
Parameters: aConnection: the connection used in the transaction.
Remark: Close transaction by releasing the connection and all operations.
*****************************************************************************/
void
Ndb::closeTransaction(NdbConnection* aConnection)
Ndb::closeTransaction(NdbTransaction* aConnection)
{
DBUG_ENTER("Ndb::closeTransaction");
NdbConnection* tCon;
NdbConnection* tPreviousCon;
NdbTransaction* tCon;
NdbTransaction* tPreviousCon;
if (aConnection == NULL) {
//-----------------------------------------------------
......@@ -511,12 +511,12 @@ Ndb::closeTransaction(NdbConnection* aConnection)
if(aConnection->theError.code == 4008){
/**
* When a SCAN timed-out, returning the NdbConnection leads
* When a SCAN timed-out, returning the NdbTransaction leads
* to reuse. And TC crashes when the API tries to reuse it to
* something else...
*/
#ifdef VM_TRACE
printf("Scan timeout:ed NdbConnection-> "
printf("Scan timeout:ed NdbTransaction-> "
"not returning it-> memory leak\n");
#endif
DBUG_VOID_RETURN;
......@@ -538,12 +538,12 @@ Ndb::closeTransaction(NdbConnection* aConnection)
if(aConnection->theError.code == 4008){
/**
* Something timed-out, returning the NdbConnection leads
* Something timed-out, returning the NdbTransaction leads
* to reuse. And TC crashes when the API tries to reuse it to
* something else...
*/
#ifdef VM_TRACE
printf("Con timeout:ed NdbConnection-> not returning it-> memory leak\n");
printf("Con timeout:ed NdbTransaction-> not returning it-> memory leak\n");
#endif
DBUG_VOID_RETURN;
}
......@@ -582,7 +582,7 @@ Remark: Sends a signal to DIH.
int
Ndb::NdbTamper(TamperType aAction, int aNode)
{
NdbConnection* tNdbConn;
NdbTransaction* tNdbConn;
NdbApiSignal tSignal(theMyRef);
int tNode;
int tAction;
......@@ -624,7 +624,7 @@ Ndb::NdbTamper(TamperType aAction, int aNode)
tSignal.setData (tAction, 1);
tSignal.setData(tNdbConn->ptr2int(),2);
tSignal.setData(theMyRef,3); // Set return block reference
tNdbConn->Status(NdbConnection::Connecting); // Set status to connecting
tNdbConn->Status(NdbTransaction::Connecting); // Set status to connecting
TransporterFacade *tp = TransporterFacade::instance();
if (tAction == 3) {
tp->lock_mutex();
......@@ -657,7 +657,7 @@ Ndb::NdbTamper(TamperType aAction, int aNode)
}//if
ret_code = sendRecSignal(tNode, WAIT_NDB_TAMPER, &tSignal, 0);
if (ret_code == 0) {
if (tNdbConn->Status() != NdbConnection::Connected) {
if (tNdbConn->Status() != NdbTransaction::Connected) {
theRestartGCI = 0;
}//if
releaseNdbCon(tNdbConn);
......@@ -914,7 +914,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
{
DEBUG_TRACE("opTupleIdOnNdb");
NdbConnection* tConnection;
NdbTransaction* tConnection;
NdbOperation* tOperation;
Uint64 tValue;
NdbRecAttr* tRecAttrResult;
......@@ -1368,7 +1368,7 @@ Ndb::pollEvents(int aMillisecondNumber)
extern NdbMutex *ndb_print_state_mutex;
static bool
checkdups(NdbConnection** list, unsigned no)
checkdups(NdbTransaction** list, unsigned no)
{
for (unsigned i = 0; i < no; i++)
for (unsigned j = i + 1; j < no; j++)
......@@ -1393,7 +1393,7 @@ Ndb::printState(const char* fmt, ...)
#endif
ndbout << endl;
for (unsigned n = 0; n < MAX_NDB_NODES; n++) {
NdbConnection* con = theConnectionArray[n];
NdbTransaction* con = theConnectionArray[n];
if (con != 0) {
ndbout << "conn " << n << ":" << endl;
while (con != 0) {
......
......@@ -93,7 +93,7 @@ private:
void setDataPtr(Uint32 *);
friend class NdbConnection;
friend class NdbTransaction;
friend class NdbScanReceiver;
friend class Table;
void copyFrom(const NdbApiSignal * src);
......
......@@ -16,7 +16,7 @@
#include <Ndb.hpp>
#include <NdbDictionaryImpl.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp>
#include <NdbIndexOperation.hpp>
#include <NdbRecAttr.hpp>
......@@ -1059,7 +1059,7 @@ NdbBlob::invokeActiveHook()
* data. For read operation adds read of head+inline.
*/
int
NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn)
NdbBlob::atPrepare(NdbTransaction* aCon, NdbOperation* anOp, const NdbColumnImpl* aColumn)
{
assert(theState == Idle);
// ndb api stuff
......@@ -1550,7 +1550,7 @@ NdbBlob::setErrorCode(NdbOperation* anOp, bool invalidFlag)
}
void
NdbBlob::setErrorCode(NdbConnection* aCon, bool invalidFlag)
NdbBlob::setErrorCode(NdbTransaction* aCon, bool invalidFlag)
{
int code = 0;
if (theNdbCon != NULL && (code = theNdbCon->theError.code) != 0)
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbCursorOperation.cpp
* Include:
* Link:
* Author: UABMASD Martin Sköld INN/V Alzato
* Date: 2002-04-01
* Version: 0.1
* Description: Cursor support
* Documentation:
* Adjust: 2002-04-01 UABMASD First version.
****************************************************************************/
#include <NdbCursorOperation.hpp>
#include <NdbResultSet.hpp>
NdbCursorOperation::NdbCursorOperation(Ndb* aNdb) :
{
}
NdbCursorOperation::~NdbCursorOperation()
{
if (m_resultSet)
delete m_resultSet;
}
void NdbCursorOperation::cursInit()
{
// Initialize result set
}
NdbResultSet* NdbCursorOperation::getResultSet()
{
}
......@@ -35,6 +35,7 @@ public:
#include <NdbError.hpp>
#include <NdbCondition.h>
#include <NdbReceiver.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp>
#include <NdbTick.h>
......
......@@ -17,7 +17,7 @@
#include <ndb_global.h>
#include <NdbIndexOperation.hpp>
#include <Ndb.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include "NdbApiSignal.hpp"
#include <AttributeHeader.hpp>
#include <signaldata/TcIndx.hpp>
......@@ -53,7 +53,7 @@ NdbIndexOperation::~NdbIndexOperation()
int
NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex,
const NdbTableImpl * aTable,
NdbConnection* myConnection)
NdbTransaction* myConnection)
{
NdbOperation::init(aTable, myConnection);
......
......@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp>
#include "NdbApiSignal.hpp"
#include "NdbRecAttr.hpp"
......@@ -128,7 +128,7 @@ NdbOperation::setErrorCodeAbort(int anErrorCode)
*****************************************************************************/
int
NdbOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection){
NdbOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection){
NdbApiSignal* tSignal;
theStatus = Init;
theError.code = 0;
......
......@@ -14,28 +14,17 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbOperationDefine.C
* Include:
* Link:
* Author: UABMNST Mona Natterkvist UAB/B/SD
* Date: 970829
* Version: 0.1
* Description: Interface between TIS and NDB
* Documentation:
* Adjust: 971022 UABMNST First version.
*****************************************************************************/
#include "NdbOperation.hpp"
#include <ndb_global.h>
#include <NdbOperation.hpp>
#include "NdbApiSignal.hpp"
#include "NdbConnection.hpp"
#include "Ndb.hpp"
#include "NdbRecAttr.hpp"
#include <NdbTransaction.hpp>
#include <Ndb.hpp>
#include <NdbRecAttr.hpp>
#include "NdbUtil.hpp"
#include "NdbOut.hpp"
#include "NdbImpl.hpp"
#include <NdbIndexScanOperation.hpp>
#include "NdbBlob.hpp"
#include <NdbBlob.hpp>
#include <Interpreter.hpp>
......@@ -48,7 +37,7 @@
int
NdbOperation::insertTuple()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -68,7 +57,7 @@ NdbOperation::insertTuple()
int
NdbOperation::updateTuple()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -88,7 +77,7 @@ NdbOperation::updateTuple()
int
NdbOperation::writeTuple()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -128,7 +117,7 @@ NdbOperation::readTuple(NdbOperation::LockMode lm)
int
NdbOperation::readTuple()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -149,7 +138,7 @@ NdbOperation::readTuple()
int
NdbOperation::deleteTuple()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -170,7 +159,7 @@ NdbOperation::deleteTuple()
int
NdbOperation::readTupleExclusive()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -247,7 +236,7 @@ NdbOperation::committedRead()
int
NdbOperation::dirtyUpdate()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -270,7 +259,7 @@ NdbOperation::dirtyUpdate()
int
NdbOperation::dirtyWrite()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -293,7 +282,7 @@ NdbOperation::dirtyWrite()
int
NdbOperation::interpretedUpdateTuple()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -316,7 +305,7 @@ NdbOperation::interpretedUpdateTuple()
int
NdbOperation::interpretedDeleteTuple()
{
NdbConnection* tNdbCon = theNdbCon;
NdbTransaction* tNdbCon = theNdbCon;
int tErrorLine = theErrorLine;
if (theStatus == Init) {
theStatus = OperationDefined;
......@@ -578,7 +567,7 @@ NdbOperation::setValue( const NdbColumnImpl* tAttrInfo,
}//NdbOperation::setValue()
NdbBlob*
NdbOperation::getBlobHandle(NdbConnection* aCon, const NdbColumnImpl* tAttrInfo)
NdbOperation::getBlobHandle(NdbTransaction* aCon, const NdbColumnImpl* tAttrInfo)
{
NdbBlob* tBlob = theBlobList;
NdbBlob* tLastBlob = NULL;
......
......@@ -16,7 +16,7 @@
#include <ndb_global.h>
#include <NdbOperation.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include "NdbApiSignal.hpp"
#include <Ndb.hpp>
#include <NdbRecAttr.hpp>
......@@ -544,7 +544,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
// blobs want this
if (m_abortOption != AO_IgnoreError)
{
theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
theNdbCon->theReturnStatus = NdbTransaction::ReturnFailure;
}
theError.code = aSignal->readData(4);
theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao);
......
......@@ -14,23 +14,11 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/************************************************************************************************
Name: NdbOperationInt.C
Include:
Link:
Author: UABRONM Mikael Ronstrm UAB/M/MT
Date: 991029
Version: 0.1
Description: Interpreted operations in NDB API
Documentation:
Adjust: 991029 UABRONM First version.
************************************************************************************************/
#include "NdbOperation.hpp"
#include <NdbOperation.hpp>
#include "NdbApiSignal.hpp"
#include "NdbConnection.hpp"
#include "Ndb.hpp"
#include "NdbRecAttr.hpp"
#include <NdbTransaction.hpp>
#include <Ndb.hpp>
#include <NdbRecAttr.hpp>
#include "NdbUtil.hpp"
#include "Interpreter.hpp"
#include <NdbIndexScanOperation.hpp>
......@@ -94,7 +82,7 @@ NdbOperation::incCheck(const NdbColumnImpl* tNdbColumnImpl)
}
return tNdbColumnImpl->m_attrId;
} else {
if (theNdbCon->theCommitStatus == NdbConnection::Started)
if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200);
}
return -1;
......@@ -146,7 +134,7 @@ NdbOperation::write_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
}
return tNdbColumnImpl->m_attrId;
} else {
if (theNdbCon->theCommitStatus == NdbConnection::Started)
if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200);
}
return -1;
......@@ -194,7 +182,7 @@ NdbOperation::read_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
}
return tNdbColumnImpl->m_attrId;
} else {
if (theNdbCon->theCommitStatus == NdbConnection::Started)
if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200);
}
return -1;
......@@ -230,7 +218,7 @@ NdbOperation::initial_interpreterCheck()
}
return 0;
} else {
if (theNdbCon->theCommitStatus == NdbConnection::Started)
if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200);
}
return -1;
......@@ -256,7 +244,7 @@ NdbOperation::labelCheck()
}
return 0;
} else {
if (theNdbCon->theCommitStatus == NdbConnection::Started)
if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200);
}
return -1;
......@@ -276,7 +264,7 @@ NdbOperation::intermediate_interpreterCheck()
}
return 0;
} else {
if (theNdbCon->theCommitStatus == NdbConnection::Started)
if (theNdbCon->theCommitStatus == NdbTransaction::Started)
setErrorCodeAbort(4200);
}
return -1;
......
......@@ -31,7 +31,7 @@ Adjust: 971022 UABMNST First version.
#include <NdbOperation.hpp>
#include "NdbApiSignal.hpp"
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <Ndb.hpp>
#include "NdbImpl.hpp"
#include <NdbOut.hpp>
......
......@@ -20,7 +20,7 @@
#include "NdbDictionaryImpl.hpp"
#include <NdbRecAttr.hpp>
#include <AttributeHeader.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <TransporterFacade.hpp>
#include <signaldata/TcKeyConf.hpp>
......
......@@ -18,7 +18,7 @@
#include <Ndb.hpp>
#include <NdbScanOperation.hpp>
#include <NdbIndexScanOperation.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include "NdbApiSignal.hpp"
#include <NdbOut.hpp>
#include "NdbDictionaryImpl.hpp"
......@@ -63,7 +63,7 @@ NdbScanOperation::~NdbScanOperation()
void
NdbScanOperation::setErrorCode(int aErrorCode){
NdbConnection* tmp = theNdbCon;
NdbTransaction* tmp = theNdbCon;
theNdbCon = m_transConnection;
NdbOperation::setErrorCode(aErrorCode);
theNdbCon = tmp;
......@@ -71,7 +71,7 @@ NdbScanOperation::setErrorCode(int aErrorCode){
void
NdbScanOperation::setErrorCodeAbort(int aErrorCode){
NdbConnection* tmp = theNdbCon;
NdbTransaction* tmp = theNdbCon;
theNdbCon = m_transConnection;
NdbOperation::setErrorCodeAbort(aErrorCode);
theNdbCon = tmp;
......@@ -86,11 +86,11 @@ NdbScanOperation::setErrorCodeAbort(int aErrorCode){
* Remark: Initiates operation record after allocation.
*****************************************************************************/
int
NdbScanOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection)
NdbScanOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection)
{
m_transConnection = myConnection;
//NdbConnection* aScanConnection = theNdb->startTransaction(myConnection);
NdbConnection* aScanConnection = theNdb->hupp(myConnection);
//NdbTransaction* aScanConnection = theNdb->startTransaction(myConnection);
NdbTransaction* aScanConnection = theNdb->hupp(myConnection);
if (!aScanConnection){
setErrorCodeAbort(theNdb->getNdbError().code);
return -1;
......@@ -349,7 +349,7 @@ NdbScanOperation::getFirstATTRINFOScan()
int
NdbScanOperation::executeCursor(int nodeId){
NdbConnection * tCon = theNdbCon;
NdbTransaction * tCon = theNdbCon;
TransporterFacade* tp = TransporterFacade::instance();
Guard guard(tp->theMutexPtr);
......@@ -383,7 +383,7 @@ NdbScanOperation::executeCursor(int nodeId){
TRACE_DEBUG("The node is stopping when attempting to start a scan");
setErrorCode(4030);
}//if
tCon->theCommitStatus = NdbConnection::Aborted;
tCon->theCommitStatus = NdbTransaction::Aborted;
}//if
return -1;
}
......@@ -856,9 +856,9 @@ NdbScanOperation::doSendScan(int aProcessorId)
}//NdbOperation::doSendScan()
/*****************************************************************************
* NdbOperation* takeOverScanOp(NdbConnection* updateTrans);
* NdbOperation* takeOverScanOp(NdbTransaction* updateTrans);
*
* Parameters: The update transactions NdbConnection pointer.
* Parameters: The update transactions NdbTransaction pointer.
* Return Value: A reference to the transferred operation object
* or NULL if no success.
* Remark: Take over the scanning transactions NdbOperation
......@@ -868,8 +868,8 @@ NdbScanOperation::doSendScan(int aProcessorId)
*
* FUTURE IMPLEMENTATION: (This note was moved from header file.)
* In the future, it will even be possible to transfer
* to a NdbConnection on another Ndb-object.
* In this case the receiving NdbConnection-object must call
* to a NdbTransaction on another Ndb-object.
* In this case the receiving NdbTransaction-object must call
* a method receiveOpFromScan to actually receive the information.
* This means that the updating transactions can be placed
* in separate threads and thus increasing the parallelism during
......@@ -896,7 +896,7 @@ NdbScanOperation::getKeyFromKEYINFO20(Uint32* data, unsigned size)
}
NdbOperation*
NdbScanOperation::takeOverScanOp(OperationType opType, NdbConnection* pTrans){
NdbScanOperation::takeOverScanOp(OperationType opType, NdbTransaction* pTrans){
Uint32 idx = m_current_api_receiver;
Uint32 last = m_api_receivers_count;
......
......@@ -16,7 +16,7 @@
#include <ndb_global.h>
#include <NdbOut.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp>
#include <NdbScanOperation.hpp>
#include <NdbIndexScanOperation.hpp>
......@@ -34,13 +34,13 @@
#include <signaldata/TcHbRep.hpp>
/*****************************************************************************
NdbConnection( Ndb* aNdb );
NdbTransaction( Ndb* aNdb );
Return Value: None
Parameters: aNdb: Pointers to the Ndb object
Remark: Creates a connection object.
*****************************************************************************/
NdbConnection::NdbConnection( Ndb* aNdb ) :
NdbTransaction::NdbTransaction( Ndb* aNdb ) :
theSendStatus(NotInit),
theCallbackFunction(NULL),
theCallbackObject(NULL),
......@@ -89,19 +89,19 @@ NdbConnection::NdbConnection( Ndb* aNdb ) :
CHECK_SZ(m_db_nodes, NdbNodeBitmask::Size);
CHECK_SZ(m_failed_db_nodes, NdbNodeBitmask::Size);
}//NdbConnection::NdbConnection()
}//NdbTransaction::NdbTransaction()
/*****************************************************************************
~NdbConnection();
~NdbTransaction();
Remark: Deletes the connection object.
*****************************************************************************/
NdbConnection::~NdbConnection()
NdbTransaction::~NdbTransaction()
{
DBUG_ENTER("NdbConnection::~NdbConnection");
DBUG_ENTER("NdbTransaction::~NdbTransaction");
theNdb->theNdbObjectIdMap->unmap(theId, this);
DBUG_VOID_RETURN;
}//NdbConnection::~NdbConnection()
}//NdbTransaction::~NdbTransaction()
/*****************************************************************************
void init();
......@@ -109,7 +109,7 @@ void init();
Remark: Initialise connection object for new transaction.
*****************************************************************************/
void
NdbConnection::init()
NdbTransaction::init()
{
theListState = NotInList;
theInUseState = true;
......@@ -149,7 +149,7 @@ NdbConnection::init()
//
theBlobFlag = false;
thePendingBlobOps = 0;
}//NdbConnection::init()
}//NdbTransaction::init()
/*****************************************************************************
setOperationErrorCode(int error);
......@@ -158,9 +158,9 @@ Remark: Sets an error code on the connection object from an
operation object.
*****************************************************************************/
void
NdbConnection::setOperationErrorCode(int error)
NdbTransaction::setOperationErrorCode(int error)
{
DBUG_ENTER("NdbConnection::setOperationErrorCode");
DBUG_ENTER("NdbTransaction::setOperationErrorCode");
setErrorCode(error);
DBUG_VOID_RETURN;
}
......@@ -172,9 +172,9 @@ Remark: Sets an error code on the connection object from an
operation object.
*****************************************************************************/
void
NdbConnection::setOperationErrorCodeAbort(int error, int abortOption)
NdbTransaction::setOperationErrorCodeAbort(int error, int abortOption)
{
DBUG_ENTER("NdbConnection::setOperationErrorCodeAbort");
DBUG_ENTER("NdbTransaction::setOperationErrorCodeAbort");
if (abortOption == -1)
abortOption = m_abortOption;
if (theTransactionIsStarted == false) {
......@@ -194,20 +194,20 @@ setErrorCode(int anErrorCode);
Remark: Sets an error indication on the connection object.
*****************************************************************************/
void
NdbConnection::setErrorCode(int error)
NdbTransaction::setErrorCode(int error)
{
DBUG_ENTER("NdbConnection::setErrorCode");
DBUG_ENTER("NdbTransaction::setErrorCode");
DBUG_PRINT("enter", ("error: %d, theError.code: %d", error, theError.code));
if (theError.code == 0)
theError.code = error;
DBUG_VOID_RETURN;
}//NdbConnection::setErrorCode()
}//NdbTransaction::setErrorCode()
int
NdbConnection::restart(){
DBUG_ENTER("NdbConnection::restart");
NdbTransaction::restart(){
DBUG_ENTER("NdbTransaction::restart");
if(theCompletionStatus == CompletedSuccess){
releaseCompletedOperations();
Uint64 tTransid = theNdb->theFirstTransId;
......@@ -232,7 +232,7 @@ void handleExecuteCompletion(void);
Remark: Handle time-out on a transaction object.
*****************************************************************************/
void
NdbConnection::handleExecuteCompletion()
NdbTransaction::handleExecuteCompletion()
{
/***************************************************************************
* Move the NdbOperation objects from the list of executing
......@@ -250,7 +250,7 @@ NdbConnection::handleExecuteCompletion()
}//if
theSendStatus = InitState;
return;
}//NdbConnection::handleExecuteCompletion()
}//NdbTransaction::handleExecuteCompletion()
/*****************************************************************************
int execute(ExecType aTypeOfExec, CommitType aTypeOfCommit, int forceSend);
......@@ -261,11 +261,11 @@ Parameters : aTypeOfExec: Type of execute.
Remark: Initialise connection object for new transaction.
*****************************************************************************/
int
NdbConnection::execute(ExecType aTypeOfExec,
NdbTransaction::execute(ExecType aTypeOfExec,
AbortOption abortOption,
int forceSend)
{
DBUG_ENTER("NdbConnection::execute");
DBUG_ENTER("NdbTransaction::execute");
DBUG_PRINT("enter", ("aTypeOfExec: %d, abortOption: %d",
aTypeOfExec, abortOption));
......@@ -396,11 +396,11 @@ NdbConnection::execute(ExecType aTypeOfExec,
}
int
NdbConnection::executeNoBlobs(ExecType aTypeOfExec,
NdbTransaction::executeNoBlobs(ExecType aTypeOfExec,
AbortOption abortOption,
int forceSend)
{
DBUG_ENTER("NdbConnection::executeNoBlobs");
DBUG_ENTER("NdbTransaction::executeNoBlobs");
DBUG_PRINT("enter", ("aTypeOfExec: %d, abortOption: %d",
aTypeOfExec, abortOption));
......@@ -409,7 +409,7 @@ NdbConnection::executeNoBlobs(ExecType aTypeOfExec,
// since last execute or since beginning. If this works ok we will continue
// by calling the poll with wait method. This method will return when
// the NDB kernel has completed its task or when 10 seconds have passed.
// The NdbConnectionCallBack-method will receive the return code of the
// The NdbTransactionCallBack-method will receive the return code of the
// transaction. The normal methods of reading error codes still apply.
//------------------------------------------------------------------------
Ndb* tNdb = theNdb;
......@@ -457,7 +457,7 @@ NdbConnection::executeNoBlobs(ExecType aTypeOfExec,
}
thePendingBlobOps = 0;
DBUG_RETURN(0);
}//NdbConnection::execute()
}//NdbTransaction::execute()
/*****************************************************************************
void executeAsynchPrepare(ExecType aTypeOfExec,
......@@ -475,12 +475,12 @@ Parameters : aTypeOfExec: Type of execute.
Remark: Prepare a part of a transaction in an asynchronous manner.
*****************************************************************************/
void
NdbConnection::executeAsynchPrepare( ExecType aTypeOfExec,
NdbTransaction::executeAsynchPrepare( ExecType aTypeOfExec,
NdbAsynchCallback aCallback,
void* anyObject,
AbortOption abortOption)
{
DBUG_ENTER("NdbConnection::executeAsynchPrepare");
DBUG_ENTER("NdbTransaction::executeAsynchPrepare");
DBUG_PRINT("enter", ("aTypeOfExec: %d, aCallback: %x, anyObject: %x",
aTypeOfExec, aCallback, anyObject));
......@@ -643,14 +643,14 @@ NdbConnection::executeAsynchPrepare( ExecType aTypeOfExec,
NdbNodeBitmask::clear(m_db_nodes);
NdbNodeBitmask::clear(m_failed_db_nodes);
DBUG_VOID_RETURN;
}//NdbConnection::executeAsynchPrepare()
}//NdbTransaction::executeAsynchPrepare()
void NdbConnection::close()
void NdbTransaction::close()
{
theNdb->closeTransaction(this);
}
int NdbConnection::refresh(){
int NdbTransaction::refresh(){
return sendTC_HBREP();
}
......@@ -662,7 +662,7 @@ Parameters : None.
Remark: Order NDB to refresh the timeout counter of the transaction.
******************************************************************************/
int
NdbConnection::sendTC_HBREP() // Send a TC_HBREP signal;
NdbTransaction::sendTC_HBREP() // Send a TC_HBREP signal;
{
NdbApiSignal* tSignal;
Ndb* tNdb = theNdb;
......@@ -697,7 +697,7 @@ NdbConnection::sendTC_HBREP() // Send a TC_HBREP signal;
}
return 0;
}//NdbConnection::sendTC_HBREP()
}//NdbTransaction::sendTC_HBREP()
/*****************************************************************************
int doSend();
......@@ -709,9 +709,9 @@ Remark: Send all operations belonging to this connection.
object from the prepared transactions array on the Ndb-object.
*****************************************************************************/
int
NdbConnection::doSend()
NdbTransaction::doSend()
{
DBUG_ENTER("NdbConnection::doSend");
DBUG_ENTER("NdbTransaction::doSend");
/*
This method assumes that at least one operation have been defined. This
......@@ -770,7 +770,7 @@ NdbConnection::doSend()
theTransactionIsStarted = false;
theCommitStatus = Aborted;
DBUG_RETURN(-1);
}//NdbConnection::doSend()
}//NdbTransaction::doSend()
/**************************************************************************
int sendROLLBACK();
......@@ -780,7 +780,7 @@ Parameters : None.
Remark: Order NDB to rollback the transaction.
**************************************************************************/
int
NdbConnection::sendROLLBACK() // Send a TCROLLBACKREQ signal;
NdbTransaction::sendROLLBACK() // Send a TCROLLBACKREQ signal;
{
Ndb* tNdb = theNdb;
if ((theTransactionIsStarted == true) &&
......@@ -824,7 +824,7 @@ NdbConnection::sendROLLBACK() // Send a TCROLLBACKREQ signal;
return 0;
;
}//if
}//NdbConnection::sendROLLBACK()
}//NdbTransaction::sendROLLBACK()
/***************************************************************************
int sendCOMMIT();
......@@ -835,7 +835,7 @@ Parameters : None.
Remark: Order NDB to commit the transaction.
***************************************************************************/
int
NdbConnection::sendCOMMIT() // Send a TC_COMMITREQ signal;
NdbTransaction::sendCOMMIT() // Send a TC_COMMITREQ signal;
{
NdbApiSignal tSignal(theNdb->theMyRef);
Uint32 tTransId1, tTransId2;
......@@ -857,7 +857,7 @@ NdbConnection::sendCOMMIT() // Send a TC_COMMITREQ signal;
} else {
return -1;
}//if
}//NdbConnection::sendCOMMIT()
}//NdbTransaction::sendCOMMIT()
/******************************************************************************
void release();
......@@ -865,7 +865,7 @@ void release();
Remark: Release all operations.
******************************************************************************/
void
NdbConnection::release(){
NdbTransaction::release(){
releaseOperations();
if ( (theTransactionIsStarted == true) &&
((theCommitStatus != Committed) &&
......@@ -884,10 +884,10 @@ NdbConnection::release(){
abort();
}
#endif
}//NdbConnection::release()
}//NdbTransaction::release()
void
NdbConnection::releaseOps(NdbOperation* tOp){
NdbTransaction::releaseOps(NdbOperation* tOp){
while (tOp != NULL) {
NdbOperation* tmp = tOp;
tOp->release();
......@@ -902,7 +902,7 @@ void releaseOperations();
Remark: Release all operations.
******************************************************************************/
void
NdbConnection::releaseOperations()
NdbTransaction::releaseOperations()
{
// Release any open scans
releaseScanOperations(m_theFirstScanOperation);
......@@ -922,15 +922,15 @@ NdbConnection::releaseOperations()
m_theFirstScanOperation = NULL;
m_theLastScanOperation = NULL;
m_firstExecutedScanOp = NULL;
}//NdbConnection::releaseOperations()
}//NdbTransaction::releaseOperations()
void
NdbConnection::releaseCompletedOperations()
NdbTransaction::releaseCompletedOperations()
{
releaseOps(theCompletedFirstOp);
theCompletedFirstOp = NULL;
theCompletedLastOp = NULL;
}//NdbConnection::releaseOperations()
}//NdbTransaction::releaseOperations()
/******************************************************************************
void releaseScanOperations();
......@@ -939,7 +939,7 @@ Remark: Release all cursor operations.
(NdbScanOperation and NdbIndexOperation)
******************************************************************************/
void
NdbConnection::releaseScanOperations(NdbIndexScanOperation* cursorOp)
NdbTransaction::releaseScanOperations(NdbIndexScanOperation* cursorOp)
{
while(cursorOp != 0){
NdbIndexScanOperation* next = (NdbIndexScanOperation*)cursorOp->next();
......@@ -947,7 +947,7 @@ NdbConnection::releaseScanOperations(NdbIndexScanOperation* cursorOp)
theNdb->releaseScanOperation(cursorOp);
cursorOp = next;
}
}//NdbConnection::releaseScanOperations()
}//NdbTransaction::releaseScanOperations()
/*****************************************************************************
NdbOperation* getNdbOperation(const char* aTableName);
......@@ -957,13 +957,13 @@ Return Value Return a pointer to a NdbOperation object if getNdbOperation
Return NULL : In all other case.
Parameters: aTableName : Name of the database table.
Remark: Get an operation from NdbOperation idlelist and get the
NdbConnection object
NdbTransaction object
who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbOperation object.
synchronous
******************************************************************************/
NdbOperation*
NdbConnection::getNdbOperation(const char* aTableName)
NdbTransaction::getNdbOperation(const char* aTableName)
{
if (theCommitStatus == Started){
NdbTableImpl* table = theNdb->theDictionary->getTable(aTableName);
......@@ -978,7 +978,7 @@ NdbConnection::getNdbOperation(const char* aTableName)
setOperationErrorCodeAbort(4114);
return NULL;
}//NdbConnection::getNdbOperation()
}//NdbTransaction::getNdbOperation()
/*****************************************************************************
NdbOperation* getNdbOperation(int aTableId);
......@@ -988,13 +988,13 @@ Return Value Return a pointer to a NdbOperation object if getNdbOperation
Return NULL: In all other case.
Parameters: tableId : Id of the database table beeing deleted.
Remark: Get an operation from NdbOperation object idlelist and
get the NdbConnection object who was fetch by
get the NdbTransaction object who was fetch by
startTransaction pointing to this operation
getOperation will set the theTableId in the NdbOperation
object, synchronous.
*****************************************************************************/
NdbOperation*
NdbConnection::getNdbOperation(const NdbTableImpl * tab, NdbOperation* aNextOp)
NdbTransaction::getNdbOperation(const NdbTableImpl * tab, NdbOperation* aNextOp)
{
NdbOperation* tOp;
......@@ -1038,15 +1038,15 @@ NdbConnection::getNdbOperation(const NdbTableImpl * tab, NdbOperation* aNextOp)
getNdbOp_error1:
setOperationErrorCodeAbort(4000);
return NULL;
}//NdbConnection::getNdbOperation()
}//NdbTransaction::getNdbOperation()
NdbOperation* NdbConnection::getNdbOperation(const NdbDictionary::Table * table)
NdbOperation* NdbTransaction::getNdbOperation(const NdbDictionary::Table * table)
{
if (table)
return getNdbOperation(& NdbTableImpl::getImpl(*table));
else
return NULL;
}//NdbConnection::getNdbOperation()
}//NdbTransaction::getNdbOperation()
// NdbScanOperation
/*****************************************************************************
......@@ -1055,12 +1055,12 @@ NdbScanOperation* getNdbScanOperation(const char* aTableName);
Return Value Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful.
Return NULL : In all other case.
Parameters: aTableName : Name of the database table.
Remark: Get an operation from NdbScanOperation idlelist and get the NdbConnection object
Remark: Get an operation from NdbScanOperation idlelist and get the NdbTransaction object
who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbOperation object.synchronous
******************************************************************************/
NdbScanOperation*
NdbConnection::getNdbScanOperation(const char* aTableName)
NdbTransaction::getNdbScanOperation(const char* aTableName)
{
if (theCommitStatus == Started){
NdbTableImpl* tab = theNdb->theDictionary->getTable(aTableName);
......@@ -1074,7 +1074,7 @@ NdbConnection::getNdbScanOperation(const char* aTableName)
setOperationErrorCodeAbort(4114);
return NULL;
}//NdbConnection::getNdbScanOperation()
}//NdbTransaction::getNdbScanOperation()
/*****************************************************************************
NdbScanOperation* getNdbScanOperation(const char* anIndexName, const char* aTableName);
......@@ -1083,12 +1083,12 @@ Return Value Return a pointer to a NdbScanOperation object if getNdbScanOpera
Return NULL : In all other case.
Parameters: anIndexName : Name of the index to use.
aTableName : Name of the database table.
Remark: Get an operation from NdbScanOperation idlelist and get the NdbConnection object
Remark: Get an operation from NdbScanOperation idlelist and get the NdbTransaction object
who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbOperation object.synchronous
******************************************************************************/
NdbIndexScanOperation*
NdbConnection::getNdbIndexScanOperation(const char* anIndexName,
NdbTransaction::getNdbIndexScanOperation(const char* anIndexName,
const char* aTableName)
{
NdbIndexImpl* index =
......@@ -1099,7 +1099,7 @@ NdbConnection::getNdbIndexScanOperation(const char* anIndexName,
}
NdbIndexScanOperation*
NdbConnection::getNdbIndexScanOperation(const NdbIndexImpl* index,
NdbTransaction::getNdbIndexScanOperation(const NdbIndexImpl* index,
const NdbTableImpl* table)
{
if (theCommitStatus == Started){
......@@ -1119,10 +1119,10 @@ NdbConnection::getNdbIndexScanOperation(const NdbIndexImpl* index,
setOperationErrorCodeAbort(4114);
return NULL;
}//NdbConnection::getNdbIndexScanOperation()
}//NdbTransaction::getNdbIndexScanOperation()
NdbIndexScanOperation*
NdbConnection::getNdbIndexScanOperation(const NdbDictionary::Index * index,
NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index,
const NdbDictionary::Table * table)
{
if (index && table)
......@@ -1130,7 +1130,7 @@ NdbConnection::getNdbIndexScanOperation(const NdbDictionary::Index * index,
& NdbTableImpl::getImpl(*table));
else
return NULL;
}//NdbConnection::getNdbIndexScanOperation()
}//NdbTransaction::getNdbIndexScanOperation()
/*****************************************************************************
NdbScanOperation* getNdbScanOperation(int aTableId);
......@@ -1138,12 +1138,12 @@ NdbScanOperation* getNdbScanOperation(int aTableId);
Return Value Return a pointer to a NdbOperation object if getNdbOperation was succesful.
Return NULL: In all other case.
Parameters: tableId : Id of the database table beeing deleted.
Remark: Get an operation from NdbScanOperation object idlelist and get the NdbConnection
Remark: Get an operation from NdbScanOperation object idlelist and get the NdbTransaction
object who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbOperation object, synchronous.
*****************************************************************************/
NdbIndexScanOperation*
NdbConnection::getNdbScanOperation(const NdbTableImpl * tab)
NdbTransaction::getNdbScanOperation(const NdbTableImpl * tab)
{
NdbIndexScanOperation* tOp;
......@@ -1162,10 +1162,10 @@ NdbConnection::getNdbScanOperation(const NdbTableImpl * tab)
getNdbOp_error1:
setOperationErrorCodeAbort(4000);
return NULL;
}//NdbConnection::getNdbScanOperation()
}//NdbTransaction::getNdbScanOperation()
void
NdbConnection::remove_list(NdbOperation*& list, NdbOperation* op){
NdbTransaction::remove_list(NdbOperation*& list, NdbOperation* op){
NdbOperation* tmp= list;
if(tmp == op)
list = op->next();
......@@ -1178,7 +1178,7 @@ NdbConnection::remove_list(NdbOperation*& list, NdbOperation* op){
}
void
NdbConnection::define_scan_op(NdbIndexScanOperation * tOp){
NdbTransaction::define_scan_op(NdbIndexScanOperation * tOp){
// Link scan operation into list of cursor operations
if (m_theLastScanOperation == NULL)
m_theFirstScanOperation = m_theLastScanOperation = tOp;
......@@ -1190,13 +1190,13 @@ NdbConnection::define_scan_op(NdbIndexScanOperation * tOp){
}
NdbScanOperation*
NdbConnection::getNdbScanOperation(const NdbDictionary::Table * table)
NdbTransaction::getNdbScanOperation(const NdbDictionary::Table * table)
{
if (table)
return getNdbScanOperation(& NdbTableImpl::getImpl(*table));
else
return NULL;
}//NdbConnection::getNdbScanOperation()
}//NdbTransaction::getNdbScanOperation()
// IndexOperation
......@@ -1207,12 +1207,12 @@ NdbIndexOperation* getNdbIndexOperation(const char* anIndexName,
Return Value Return a pointer to a NdbOperation object if getNdbScanOperation was succesful.
Return NULL : In all other case.
Parameters: aTableName : Name of the database table.
Remark: Get an operation from NdbScanOperation idlelist and get the NdbConnection object
Remark: Get an operation from NdbScanOperation idlelist and get the NdbTransaction object
who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbScanOperation object.synchronous
******************************************************************************/
NdbIndexOperation*
NdbConnection::getNdbIndexOperation(const char* anIndexName,
NdbTransaction::getNdbIndexOperation(const char* anIndexName,
const char* aTableName)
{
if (theCommitStatus == Started) {
......@@ -1235,7 +1235,7 @@ NdbConnection::getNdbIndexOperation(const char* anIndexName,
setOperationErrorCodeAbort(4114);
return 0;
}//NdbConnection::getNdbIndexOperation()
}//NdbTransaction::getNdbIndexOperation()
/*****************************************************************************
NdbIndexOperation* getNdbIndexOperation(int anIndexId, int aTableId);
......@@ -1243,12 +1243,12 @@ NdbIndexOperation* getNdbIndexOperation(int anIndexId, int aTableId);
Return Value Return a pointer to a NdbIndexOperation object if getNdbIndexOperation was succesful.
Return NULL: In all other case.
Parameters: tableId : Id of the database table beeing deleted.
Remark: Get an operation from NdbIndexOperation object idlelist and get the NdbConnection
Remark: Get an operation from NdbIndexOperation object idlelist and get the NdbTransaction
object who was fetch by startTransaction pointing to this operation
getOperation will set the theTableId in the NdbIndexOperation object, synchronous.
*****************************************************************************/
NdbIndexOperation*
NdbConnection::getNdbIndexOperation(const NdbIndexImpl * anIndex,
NdbTransaction::getNdbIndexOperation(const NdbIndexImpl * anIndex,
const NdbTableImpl * aTable,
NdbOperation* aNextOp)
{
......@@ -1289,10 +1289,10 @@ NdbConnection::getNdbIndexOperation(const NdbIndexImpl * anIndex,
getNdbOp_error1:
setOperationErrorCodeAbort(4000);
return NULL;
}//NdbConnection::getNdbIndexOperation()
}//NdbTransaction::getNdbIndexOperation()
NdbIndexOperation*
NdbConnection::getNdbIndexOperation(const NdbDictionary::Index * index,
NdbTransaction::getNdbIndexOperation(const NdbDictionary::Index * index,
const NdbDictionary::Table * table)
{
if (index && table)
......@@ -1300,7 +1300,7 @@ NdbConnection::getNdbIndexOperation(const NdbDictionary::Index * index,
& NdbTableImpl::getImpl(*table));
else
return NULL;
}//NdbConnection::getNdbIndexOperation()
}//NdbTransaction::getNdbIndexOperation()
/*******************************************************************************
......@@ -1312,7 +1312,7 @@ Parameters: aSignal: The signal object pointer.
Remark: Sets theRestartGCI in the NDB object.
*******************************************************************************/
int
NdbConnection::receiveDIHNDBTAMPER(NdbApiSignal* aSignal)
NdbTransaction::receiveDIHNDBTAMPER(NdbApiSignal* aSignal)
{
if (theStatus != Connecting) {
return -1;
......@@ -1321,7 +1321,7 @@ NdbConnection::receiveDIHNDBTAMPER(NdbApiSignal* aSignal)
theStatus = Connected;
}//if
return 0;
}//NdbConnection::receiveDIHNDBTAMPER()
}//NdbTransaction::receiveDIHNDBTAMPER()
/*******************************************************************************
int receiveTCSEIZECONF(NdbApiSignal* aSignal);
......@@ -1332,7 +1332,7 @@ Parameters: aSignal: The signal object pointer.
Remark: Sets TC Connect pointer at reception of TCSEIZECONF.
*******************************************************************************/
int
NdbConnection::receiveTCSEIZECONF(NdbApiSignal* aSignal)
NdbTransaction::receiveTCSEIZECONF(NdbApiSignal* aSignal)
{
if (theStatus != Connecting)
{
......@@ -1343,7 +1343,7 @@ NdbConnection::receiveTCSEIZECONF(NdbApiSignal* aSignal)
theStatus = Connected;
}
return 0;
}//NdbConnection::receiveTCSEIZECONF()
}//NdbTransaction::receiveTCSEIZECONF()
/*******************************************************************************
int receiveTCSEIZEREF(NdbApiSignal* aSignal);
......@@ -1354,7 +1354,7 @@ Parameters: aSignal: The signal object pointer.
Remark: Sets TC Connect pointer.
*******************************************************************************/
int
NdbConnection::receiveTCSEIZEREF(NdbApiSignal* aSignal)
NdbTransaction::receiveTCSEIZEREF(NdbApiSignal* aSignal)
{
if (theStatus != Connecting)
{
......@@ -1365,7 +1365,7 @@ NdbConnection::receiveTCSEIZEREF(NdbApiSignal* aSignal)
theNdb->theError.code = aSignal->readData(2);
return 0;
}
}//NdbConnection::receiveTCSEIZEREF()
}//NdbTransaction::receiveTCSEIZEREF()
/*******************************************************************************
int receiveTCRELEASECONF(NdbApiSignal* aSignal);
......@@ -1376,7 +1376,7 @@ Parameters: aSignal: The signal object pointer.
Remark: DisConnect TC Connect pointer to NDBAPI.
*******************************************************************************/
int
NdbConnection::receiveTCRELEASECONF(NdbApiSignal* aSignal)
NdbTransaction::receiveTCRELEASECONF(NdbApiSignal* aSignal)
{
if (theStatus != DisConnecting)
{
......@@ -1386,7 +1386,7 @@ NdbConnection::receiveTCRELEASECONF(NdbApiSignal* aSignal)
theStatus = NotConnected;
}
return 0;
}//NdbConnection::receiveTCRELEASECONF()
}//NdbTransaction::receiveTCRELEASECONF()
/*******************************************************************************
int receiveTCRELEASEREF(NdbApiSignal* aSignal);
......@@ -1397,7 +1397,7 @@ Parameters: aSignal: The signal object pointer.
Remark: DisConnect TC Connect pointer to NDBAPI Failure.
*******************************************************************************/
int
NdbConnection::receiveTCRELEASEREF(NdbApiSignal* aSignal)
NdbTransaction::receiveTCRELEASEREF(NdbApiSignal* aSignal)
{
if (theStatus != DisConnecting) {
return -1;
......@@ -1406,7 +1406,7 @@ NdbConnection::receiveTCRELEASEREF(NdbApiSignal* aSignal)
theNdb->theError.code = aSignal->readData(2);
return 0;
}//if
}//NdbConnection::receiveTCRELEASEREF()
}//NdbTransaction::receiveTCRELEASEREF()
/******************************************************************************
int receiveTC_COMMITCONF(NdbApiSignal* aSignal);
......@@ -1417,7 +1417,7 @@ Parameters: aSignal: The signal object pointer.
Remark:
******************************************************************************/
int
NdbConnection::receiveTC_COMMITCONF(const TcCommitConf * commitConf)
NdbTransaction::receiveTC_COMMITCONF(const TcCommitConf * commitConf)
{
if(checkState_TransId(&commitConf->transId1)){
theCommitStatus = Committed;
......@@ -1429,7 +1429,7 @@ NdbConnection::receiveTC_COMMITCONF(const TcCommitConf * commitConf)
#endif
}
return -1;
}//NdbConnection::receiveTC_COMMITCONF()
}//NdbTransaction::receiveTC_COMMITCONF()
/******************************************************************************
int receiveTC_COMMITREF(NdbApiSignal* aSignal);
......@@ -1440,7 +1440,7 @@ Parameters: aSignal: The signal object pointer.
Remark:
******************************************************************************/
int
NdbConnection::receiveTC_COMMITREF(NdbApiSignal* aSignal)
NdbTransaction::receiveTC_COMMITREF(NdbApiSignal* aSignal)
{
const TcCommitRef * ref = CAST_CONSTPTR(TcCommitRef, aSignal->getDataPtr());
if(checkState_TransId(&ref->transId1)){
......@@ -1456,7 +1456,7 @@ NdbConnection::receiveTC_COMMITREF(NdbApiSignal* aSignal)
}
return -1;
}//NdbConnection::receiveTC_COMMITREF()
}//NdbTransaction::receiveTC_COMMITREF()
/******************************************************************************
int receiveTCROLLBACKCONF(NdbApiSignal* aSignal);
......@@ -1467,7 +1467,7 @@ Parameters: aSignal: The signal object pointer.
Remark:
******************************************************************************/
int
NdbConnection::receiveTCROLLBACKCONF(NdbApiSignal* aSignal)
NdbTransaction::receiveTCROLLBACKCONF(NdbApiSignal* aSignal)
{
if(checkState_TransId(aSignal->getDataPtr() + 1)){
theCommitStatus = Aborted;
......@@ -1480,7 +1480,7 @@ NdbConnection::receiveTCROLLBACKCONF(NdbApiSignal* aSignal)
}
return -1;
}//NdbConnection::receiveTCROLLBACKCONF()
}//NdbTransaction::receiveTCROLLBACKCONF()
/*******************************************************************************
int receiveTCROLLBACKREF(NdbApiSignal* aSignal);
......@@ -1491,7 +1491,7 @@ Parameters: aSignal: The signal object pointer.
Remark:
*******************************************************************************/
int
NdbConnection::receiveTCROLLBACKREF(NdbApiSignal* aSignal)
NdbTransaction::receiveTCROLLBACKREF(NdbApiSignal* aSignal)
{
if(checkState_TransId(aSignal->getDataPtr() + 1)){
setOperationErrorCodeAbort(aSignal->readData(4));
......@@ -1506,7 +1506,7 @@ NdbConnection::receiveTCROLLBACKREF(NdbApiSignal* aSignal)
}
return -1;
}//NdbConnection::receiveTCROLLBACKREF()
}//NdbTransaction::receiveTCROLLBACKREF()
/*****************************************************************************
int receiveTCROLLBACKREP( NdbApiSignal* aSignal)
......@@ -1518,7 +1518,7 @@ Parameters: aSignal: the signal object that contains the
Remark: Handles the reception of the ROLLBACKREP signal.
*****************************************************************************/
int
NdbConnection::receiveTCROLLBACKREP( NdbApiSignal* aSignal)
NdbTransaction::receiveTCROLLBACKREP( NdbApiSignal* aSignal)
{
/****************************************************************************
Check that we are expecting signals from this transaction and that it doesn't
......@@ -1546,7 +1546,7 @@ transactions.
}
return -1;
}//NdbConnection::receiveTCROLLBACKREP()
}//NdbTransaction::receiveTCROLLBACKREP()
/*******************************************************************************
int receiveTCKEYCONF(NdbApiSignal* aSignal, Uint32 long_short_ind);
......@@ -1557,7 +1557,7 @@ Parameters: aSignal: The signal object pointer.
Remark:
*******************************************************************************/
int
NdbConnection::receiveTCKEYCONF(const TcKeyConf * keyConf, Uint32 aDataLength)
NdbTransaction::receiveTCKEYCONF(const TcKeyConf * keyConf, Uint32 aDataLength)
{
NdbReceiver* tOp;
const Uint32 tTemp = keyConf->confInfo;
......@@ -1586,7 +1586,7 @@ from other transactions.
done = 1;
tOp->setErrorCode(4119);
theCompletionStatus = CompletedFailure;
theReturnStatus = NdbConnection::ReturnFailure;
theReturnStatus = NdbTransaction::ReturnFailure;
}
}
tNoComp += done;
......@@ -1616,7 +1616,7 @@ from other transactions.
/**********************************************************************/
theError.code = 4011;
theCompletionStatus = CompletedFailure;
theReturnStatus = NdbConnection::ReturnFailure;
theReturnStatus = NdbTransaction::ReturnFailure;
theCommitStatus = Aborted;
return 0;
}//if
......@@ -1631,7 +1631,7 @@ from other transactions.
}
return -1;
}//NdbConnection::receiveTCKEYCONF()
}//NdbTransaction::receiveTCKEYCONF()
/*****************************************************************************
int receiveTCKEY_FAILCONF( NdbApiSignal* aSignal)
......@@ -1643,7 +1643,7 @@ Parameters: aSignal: the signal object that contains the
Remark: Handles the reception of the TCKEY_FAILCONF signal.
*****************************************************************************/
int
NdbConnection::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf)
NdbTransaction::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf)
{
NdbOperation* tOp;
/*
......@@ -1676,7 +1676,7 @@ NdbConnection::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf)
case NdbOperation::OpenScanRequest:
case NdbOperation::OpenRangeScanRequest:
theCompletionStatus = CompletedFailure;
theReturnStatus = NdbConnection::ReturnFailure;
theReturnStatus = NdbTransaction::ReturnFailure;
setOperationErrorCodeAbort(4115);
tOp = NULL;
break;
......@@ -1694,7 +1694,7 @@ NdbConnection::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf)
#endif
}
return -1;
}//NdbConnection::receiveTCKEY_FAILCONF()
}//NdbTransaction::receiveTCKEY_FAILCONF()
/*************************************************************************
int receiveTCKEY_FAILREF( NdbApiSignal* aSignal)
......@@ -1706,7 +1706,7 @@ Parameters: aSignal: the signal object that contains the
Remark: Handles the reception of the TCKEY_FAILREF signal.
**************************************************************************/
int
NdbConnection::receiveTCKEY_FAILREF(NdbApiSignal* aSignal)
NdbTransaction::receiveTCKEY_FAILREF(NdbApiSignal* aSignal)
{
/*
Check that we are expecting signals from this transaction and
......@@ -1718,19 +1718,19 @@ NdbConnection::receiveTCKEY_FAILREF(NdbApiSignal* aSignal)
We received an indication of that this transaction was aborted due to a
node failure.
*/
if (theSendStatus == NdbConnection::sendTC_ROLLBACK) {
if (theSendStatus == NdbTransaction::sendTC_ROLLBACK) {
/*
We were in the process of sending a rollback anyways. We will
report it as a success.
*/
theCompletionStatus = NdbConnection::CompletedSuccess;
theCompletionStatus = NdbTransaction::CompletedSuccess;
} else {
theReturnStatus = NdbConnection::ReturnFailure;
theCompletionStatus = NdbConnection::CompletedFailure;
theReturnStatus = NdbTransaction::ReturnFailure;
theCompletionStatus = NdbTransaction::CompletedFailure;
theError.code = 4031;
}//if
theReleaseOnClose = true;
theCommitStatus = NdbConnection::Aborted;
theCommitStatus = NdbTransaction::Aborted;
return 0;
} else {
#ifdef VM_TRACE
......@@ -1738,7 +1738,7 @@ NdbConnection::receiveTCKEY_FAILREF(NdbApiSignal* aSignal)
#endif
}
return -1;
}//NdbConnection::receiveTCKEY_FAILREF()
}//NdbTransaction::receiveTCKEY_FAILREF()
/******************************************************************************
int receiveTCINDXCONF(NdbApiSignal* aSignal, Uint32 long_short_ind);
......@@ -1749,7 +1749,7 @@ Parameters: aSignal: The signal object pointer.
Remark:
******************************************************************************/
int
NdbConnection::receiveTCINDXCONF(const TcIndxConf * indxConf,
NdbTransaction::receiveTCINDXCONF(const TcIndxConf * indxConf,
Uint32 aDataLength)
{
if(checkState_TransId(&indxConf->transId1)){
......@@ -1783,9 +1783,9 @@ NdbConnection::receiveTCINDXCONF(const TcIndxConf * indxConf,
// no Commit flag set. This is clearly an anomaly.
/**********************************************************************/
theError.code = 4011;
theCompletionStatus = NdbConnection::CompletedFailure;
theCommitStatus = NdbConnection::Aborted;
theReturnStatus = NdbConnection::ReturnFailure;
theCompletionStatus = NdbTransaction::CompletedFailure;
theCommitStatus = NdbTransaction::Aborted;
theReturnStatus = NdbTransaction::ReturnFailure;
return 0;
}//if
if (tNoComp >= tNoSent) {
......@@ -1799,7 +1799,7 @@ NdbConnection::receiveTCINDXCONF(const TcIndxConf * indxConf,
}
return -1;
}//NdbConnection::receiveTCINDXCONF()
}//NdbTransaction::receiveTCINDXCONF()
/*****************************************************************************
int receiveTCINDXREF( NdbApiSignal* aSignal)
......@@ -1811,7 +1811,7 @@ Parameters: aSignal: the signal object that contains the
Remark: Handles the reception of the TCINDXREF signal.
*****************************************************************************/
int
NdbConnection::receiveTCINDXREF( NdbApiSignal* aSignal)
NdbTransaction::receiveTCINDXREF( NdbApiSignal* aSignal)
{
if(checkState_TransId(aSignal->getDataPtr()+1)){
theError.code = aSignal->readData(4); // Override any previous errors
......@@ -1823,9 +1823,9 @@ NdbConnection::receiveTCINDXREF( NdbApiSignal* aSignal)
/* and we only need to report completion and return with the */
/* error code to the application. */
/**********************************************************************/
theCompletionStatus = NdbConnection::CompletedFailure;
theCommitStatus = NdbConnection::Aborted;
theReturnStatus = NdbConnection::ReturnFailure;
theCompletionStatus = NdbTransaction::CompletedFailure;
theCommitStatus = NdbTransaction::Aborted;
theReturnStatus = NdbTransaction::ReturnFailure;
return 0;
} else {
#ifdef NDB_NO_DROPPED_SIGNAL
......@@ -1834,7 +1834,7 @@ NdbConnection::receiveTCINDXREF( NdbApiSignal* aSignal)
}
return -1;
}//NdbConnection::receiveTCINDXREF()
}//NdbTransaction::receiveTCINDXREF()
/*******************************************************************************
int OpCompletedFailure();
......@@ -1845,12 +1845,12 @@ Parameters: aErrorCode: The error code.
Remark: An operation was completed with failure.
*******************************************************************************/
int
NdbConnection::OpCompleteFailure(Uint8 abortOption, bool setFailure)
NdbTransaction::OpCompleteFailure(Uint8 abortOption, bool setFailure)
{
Uint32 tNoComp = theNoOfOpCompleted;
Uint32 tNoSent = theNoOfOpSent;
if (setFailure)
theCompletionStatus = NdbConnection::CompletedFailure;
theCompletionStatus = NdbTransaction::CompletedFailure;
tNoComp++;
theNoOfOpCompleted = tNoComp;
if (tNoComp == tNoSent) {
......@@ -1875,7 +1875,7 @@ NdbConnection::OpCompleteFailure(Uint8 abortOption, bool setFailure)
} else {
return -1; // Continue waiting for more signals
}//if
}//NdbConnection::OpCompleteFailure()
}//NdbTransaction::OpCompleteFailure()
/******************************************************************************
int OpCompleteSuccess();
......@@ -1885,7 +1885,7 @@ Return Value: Return 0 : OpCompleteSuccess was successful.
Remark: An operation was completed with success.
*******************************************************************************/
int
NdbConnection::OpCompleteSuccess()
NdbTransaction::OpCompleteSuccess()
{
Uint32 tNoComp = theNoOfOpCompleted;
Uint32 tNoSent = theNoOfOpSent;
......@@ -1898,11 +1898,11 @@ NdbConnection::OpCompleteSuccess()
} else {
setOperationErrorCodeAbort(4113); // Too many operations,
// stop waiting for more
theCompletionStatus = NdbConnection::CompletedFailure;
theReturnStatus = NdbConnection::ReturnFailure;
theCompletionStatus = NdbTransaction::CompletedFailure;
theReturnStatus = NdbTransaction::ReturnFailure;
return 0;
}//if
}//NdbConnection::OpCompleteSuccess()
}//NdbTransaction::OpCompleteSuccess()
/******************************************************************************
int getGCI();
......@@ -1910,13 +1910,13 @@ NdbConnection::OpCompleteSuccess()
Remark: Get global checkpoint identity of the transaction
*******************************************************************************/
int
NdbConnection::getGCI()
NdbTransaction::getGCI()
{
if (theCommitStatus == NdbConnection::Committed) {
if (theCommitStatus == NdbTransaction::Committed) {
return theGlobalCheckpointId;
}//if
return 0;
}//NdbConnection::getGCI()
}//NdbTransaction::getGCI()
/*******************************************************************************
Uint64 getTransactionId(void);
......@@ -1924,31 +1924,31 @@ Uint64 getTransactionId(void);
Remark: Get the transaction identity.
*******************************************************************************/
Uint64
NdbConnection::getTransactionId()
NdbTransaction::getTransactionId()
{
return theTransactionId;
}//NdbConnection::getTransactionId()
}//NdbTransaction::getTransactionId()
NdbConnection::CommitStatusType
NdbConnection::commitStatus()
NdbTransaction::CommitStatusType
NdbTransaction::commitStatus()
{
return theCommitStatus;
}//NdbConnection::commitStatus()
}//NdbTransaction::commitStatus()
int
NdbConnection::getNdbErrorLine()
NdbTransaction::getNdbErrorLine()
{
return theErrorLine;
}
NdbOperation*
NdbConnection::getNdbErrorOperation()
NdbTransaction::getNdbErrorOperation()
{
return theErrorOperation;
}//NdbConnection::getNdbErrorOperation()
}//NdbTransaction::getNdbErrorOperation()
const NdbOperation *
NdbConnection::getNextCompletedOperation(const NdbOperation * current) const {
NdbTransaction::getNextCompletedOperation(const NdbOperation * current) const {
if(current == 0)
return theCompletedFirstOp;
return current->theNext;
......@@ -1957,7 +1957,7 @@ NdbConnection::getNextCompletedOperation(const NdbOperation * current) const {
#ifdef VM_TRACE
#define CASE(x) case x: ndbout << " " << #x; break
void
NdbConnection::printState()
NdbTransaction::printState()
{
ndbout << "con=" << hex << this << dec;
ndbout << " node=" << getConnectedNodeId();
......@@ -2010,7 +2010,7 @@ NdbConnection::printState()
#endif
int
NdbConnection::report_node_failure(Uint32 id){
NdbTransaction::report_node_failure(Uint32 id){
NdbNodeBitmask::set(m_failed_db_nodes, id);
if(!NdbNodeBitmask::get(m_db_nodes, id))
{
......@@ -2044,11 +2044,11 @@ NdbConnection::report_node_failure(Uint32 id){
theNoOfOpCompleted = tNoComp;
if(count)
{
theReturnStatus = NdbConnection::ReturnFailure;
theReturnStatus = NdbTransaction::ReturnFailure;
if(tNoComp == tNoSent)
{
theError.code = 4119;
theCompletionStatus = NdbConnection::CompletedFailure;
theCompletionStatus = NdbTransaction::CompletedFailure;
return 1;
}
}
......
......@@ -15,22 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbConnectionScan.cpp
* Include:
* Link:
* Author: UABRONM MikaelRonström UAB/M/MT
* QABJKAM Jonas Kamf UAB/M/MT
* Date: 2000-06-12
* Version: 0.1
* Description: Interface between Application and NDB
* Documentation:
* Adjust: 2000-06-12 UABRONM First version.
****************************************************************************/
#include <ndb_global.h>
#include <Ndb.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbOperation.hpp>
#include <NdbScanOperation.hpp>
#include "NdbApiSignal.hpp"
......@@ -52,7 +40,7 @@
*
****************************************************************************/
int
NdbConnection::receiveSCAN_TABREF(NdbApiSignal* aSignal){
NdbTransaction::receiveSCAN_TABREF(NdbApiSignal* aSignal){
const ScanTabRef * ref = CAST_CONSTPTR(ScanTabRef, aSignal->getDataPtr());
if(checkState_TransId(&ref->transId1)){
......@@ -93,7 +81,7 @@ NdbConnection::receiveSCAN_TABREF(NdbApiSignal* aSignal){
*
*****************************************************************************/
int
NdbConnection::receiveSCAN_TABCONF(NdbApiSignal* aSignal,
NdbTransaction::receiveSCAN_TABCONF(NdbApiSignal* aSignal,
const Uint32 * ops, Uint32 len)
{
const ScanTabConf * conf = CAST_CONSTPTR(ScanTabConf, aSignal->getDataPtr());
......
......@@ -19,7 +19,7 @@
#include "NdbImpl.hpp"
#include "NdbDictionaryImpl.hpp"
#include <NdbOperation.hpp>
#include <NdbConnection.hpp>
#include <NdbTransaction.hpp>
#include <NdbBlob.hpp>
......@@ -55,7 +55,7 @@ NdbDictionaryImpl::getNdbError() const {
const
NdbError &
NdbConnection::getNdbError() const {
NdbTransaction::getNdbError() const {
update(theError);
return theError;
}
......
......@@ -19,12 +19,11 @@
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
#include "NdbOperation.hpp"
#include "NdbIndexOperation.hpp"
#include "NdbScanOperation.hpp"
#include "NdbConnection.hpp"
#include "NdbRecAttr.hpp"
#include "NdbReceiver.hpp"
#include <NdbOperation.hpp>
#include <NdbIndexOperation.hpp>
#include <NdbScanOperation.hpp>
#include <NdbRecAttr.hpp>
#include <NdbReceiver.hpp>
#include "API.hpp"
#include <signaldata/TcCommit.hpp>
......@@ -113,9 +112,9 @@ Ndb::init(int aMaxNoOfTransactions)
}//if
theMaxNoOfTransactions = tMaxNoOfTransactions;
thePreparedTransactionsArray = new NdbConnection* [tMaxNoOfTransactions];
theSentTransactionsArray = new NdbConnection* [tMaxNoOfTransactions];
theCompletedTransactionsArray = new NdbConnection* [tMaxNoOfTransactions];
thePreparedTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions];
theSentTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions];
theCompletedTransactionsArray = new NdbTransaction* [tMaxNoOfTransactions];
if ((thePreparedTransactionsArray == NULL) ||
(theSentTransactionsArray == NULL) ||
......@@ -271,11 +270,11 @@ Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId)
{
Uint32 tNoSentTransactions = theNoOfSentTransactions;
for (int i = tNoSentTransactions - 1; i >= 0; i--) {
NdbConnection* localCon = theSentTransactionsArray[i];
NdbTransaction* localCon = theSentTransactionsArray[i];
if (localCon->getConnectedNodeId() == aNodeId) {
const NdbConnection::SendStatusType sendStatus = localCon->theSendStatus;
if (sendStatus == NdbConnection::sendTC_OP ||
sendStatus == NdbConnection::sendTC_COMMIT) {
const NdbTransaction::SendStatusType sendStatus = localCon->theSendStatus;
if (sendStatus == NdbTransaction::sendTC_OP ||
sendStatus == NdbTransaction::sendTC_COMMIT) {
/*
A transaction was interrupted in the prepare phase by a node
failure. Since the transaction was not found in the phase
......@@ -283,13 +282,13 @@ Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId)
we report a normal node failure abort.
*/
localCon->setOperationErrorCodeAbort(4010);
localCon->theCompletionStatus = NdbConnection::CompletedFailure;
} else if (sendStatus == NdbConnection::sendTC_ROLLBACK) {
localCon->theCompletionStatus = NdbTransaction::CompletedFailure;
} else if (sendStatus == NdbTransaction::sendTC_ROLLBACK) {
/*
We aimed for abort and abort we got even if it was by a node
failure. We will thus report it as a success.
*/
localCon->theCompletionStatus = NdbConnection::CompletedSuccess;
localCon->theCompletionStatus = NdbTransaction::CompletedSuccess;
} else {
#ifdef VM_TRACE
printState("abortTransactionsAfterNodeFailure %x", this);
......@@ -301,8 +300,8 @@ Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId)
intact since the node was failing and they were aborted. Thus we
set commit state to Aborted and set state to release on close.
*/
localCon->theReturnStatus = NdbConnection::ReturnFailure;
localCon->theCommitStatus = NdbConnection::Aborted;
localCon->theReturnStatus = NdbTransaction::ReturnFailure;
localCon->theCommitStatus = NdbTransaction::Aborted;
localCon->theReleaseOnClose = true;
completedTransaction(localCon);
}
......@@ -325,7 +324,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
{
NdbOperation* tOp;
NdbIndexOperation* tIndexOp;
NdbConnection* tCon;
NdbTransaction* tCon;
int tReturnCode = -1;
const Uint32* tDataPtr = aSignal->getDataPtr();
const Uint32 tWaitState = theWaiter.m_state;
......@@ -355,14 +354,14 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
(tCon->theSendStatus == NdbConnection::sendTC_OP)) {
(tCon->theSendStatus == NdbTransaction::sendTC_OP)) {
tReturnCode = tCon->receiveTCKEYCONF(keyConf, tLen);
if (tReturnCode != -1) {
completedTransaction(tCon);
}//if
if(TcKeyConf::getMarkerFlag(keyConf->confInfo)){
NdbConnection::sendTC_COMMIT_ACK(theCommitAckSignal,
NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal,
keyConf->transId1,
keyConf->transId2,
aTCRef);
......@@ -426,8 +425,8 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber(false) == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
if ((tCon->theSendStatus == NdbConnection::sendTC_OP) ||
(tCon->theSendStatus == NdbConnection::sendTC_COMMIT)) {
if ((tCon->theSendStatus == NdbTransaction::sendTC_OP) ||
(tCon->theSendStatus == NdbTransaction::sendTC_COMMIT)) {
tReturnCode = tCon->receiveTCKEY_FAILCONF(failConf);
if (tReturnCode != -1) {
completedTransaction(tCon);
......@@ -441,7 +440,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
#endif
}
if(tFirstData & 1){
NdbConnection::sendTC_COMMIT_ACK(theCommitAckSignal,
NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal,
failConf->transId1,
failConf->transId2,
aTCRef);
......@@ -456,8 +455,8 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber() == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
if ((tCon->theSendStatus == NdbConnection::sendTC_OP) ||
(tCon->theSendStatus == NdbConnection::sendTC_ROLLBACK)) {
if ((tCon->theSendStatus == NdbTransaction::sendTC_OP) ||
(tCon->theSendStatus == NdbTransaction::sendTC_ROLLBACK)) {
tReturnCode = tCon->receiveTCKEY_FAILREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
......@@ -482,7 +481,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber() == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
if (tCon->theSendStatus == NdbConnection::sendTC_OP) {
if (tCon->theSendStatus == NdbTransaction::sendTC_OP) {
tReturnCode = tOp->receiveTCKEYREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
......@@ -505,14 +504,14 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
(tCon->theSendStatus == NdbConnection::sendTC_COMMIT)) {
(tCon->theSendStatus == NdbTransaction::sendTC_COMMIT)) {
tReturnCode = tCon->receiveTC_COMMITCONF(commitConf);
if (tReturnCode != -1) {
completedTransaction(tCon);
}//if
if(tFirstData & 1){
NdbConnection::sendTC_COMMIT_ACK(theCommitAckSignal,
NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal,
commitConf->transId1,
commitConf->transId2,
aTCRef);
......@@ -530,7 +529,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
(tCon->theSendStatus == NdbConnection::sendTC_COMMIT)) {
(tCon->theSendStatus == NdbTransaction::sendTC_COMMIT)) {
tReturnCode = tCon->receiveTC_COMMITREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
......@@ -545,7 +544,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
(tCon->theSendStatus == NdbConnection::sendTC_ROLLBACK)) {
(tCon->theSendStatus == NdbTransaction::sendTC_ROLLBACK)) {
tReturnCode = tCon->receiveTCROLLBACKCONF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
......@@ -560,7 +559,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
(tCon->theSendStatus == NdbConnection::sendTC_ROLLBACK)) {
(tCon->theSendStatus == NdbTransaction::sendTC_ROLLBACK)) {
tReturnCode = tCon->receiveTCROLLBACKREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
......@@ -797,7 +796,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
const BlockReference aTCRef = aSignal->theSendersBlockRef;
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
(tCon->theSendStatus == NdbConnection::sendTC_OP)) {
(tCon->theSendStatus == NdbTransaction::sendTC_OP)) {
tReturnCode = tCon->receiveTCINDXCONF(indxConf, tLen);
if (tReturnCode != -1) {
completedTransaction(tCon);
......@@ -805,7 +804,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
}//if
if(TcIndxConf::getMarkerFlag(indxConf->confInfo)){
NdbConnection::sendTC_COMMIT_ACK(theCommitAckSignal,
NdbTransaction::sendTC_COMMIT_ACK(theCommitAckSignal,
indxConf->transId1,
indxConf->transId2,
aTCRef);
......@@ -820,7 +819,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tIndexOp->checkMagicNumber() == 0) {
tCon = tIndexOp->theNdbCon;
if (tCon != NULL) {
if (tCon->theSendStatus == NdbConnection::sendTC_OP) {
if (tCon->theSendStatus == NdbTransaction::sendTC_OP) {
tReturnCode = tIndexOp->receiveTCINDXREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
......@@ -861,7 +860,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
/*****************************************************************************
void completedTransaction(NdbConnection* aCon);
void completedTransaction(NdbTransaction* aCon);
Remark: One transaction has been completed.
Remove it from send array and put it into the completed
......@@ -869,14 +868,14 @@ Remark: One transaction has been completed.
up a poller.
******************************************************************************/
void
Ndb::completedTransaction(NdbConnection* aCon)
Ndb::completedTransaction(NdbTransaction* aCon)
{
Uint32 tTransArrayIndex = aCon->theTransArrayIndex;
Uint32 tNoSentTransactions = theNoOfSentTransactions;
Uint32 tNoCompletedTransactions = theNoOfCompletedTransactions;
if ((tNoSentTransactions > 0) && (aCon->theListState == NdbConnection::InSendList) &&
if ((tNoSentTransactions > 0) && (aCon->theListState == NdbTransaction::InSendList) &&
(tTransArrayIndex < tNoSentTransactions)) {
NdbConnection* tMoveCon = theSentTransactionsArray[tNoSentTransactions - 1];
NdbTransaction* tMoveCon = theSentTransactionsArray[tNoSentTransactions - 1];
theCompletedTransactionsArray[tNoCompletedTransactions] = aCon;
aCon->theTransArrayIndex = tNoCompletedTransactions;
......@@ -888,7 +887,7 @@ Ndb::completedTransaction(NdbConnection* aCon)
theNoOfCompletedTransactions = tNoCompletedTransactions + 1;
theNoOfSentTransactions = tNoSentTransactions - 1;
aCon->theListState = NdbConnection::InCompletedList;
aCon->theListState = NdbTransaction::InCompletedList;
aCon->handleExecuteCompletion();
if ((theMinNoOfEventsToWakeUp != 0) &&
(theNoOfCompletedTransactions >= theMinNoOfEventsToWakeUp)) {
......@@ -909,12 +908,12 @@ Ndb::completedTransaction(NdbConnection* aCon)
}//Ndb::completedTransaction()
/*****************************************************************************
void reportCallback(NdbConnection** aCopyArray, Uint32 aNoOfCompletedTrans);
void reportCallback(NdbTransaction** aCopyArray, Uint32 aNoOfCompletedTrans);
Remark: Call the callback methods of the completed transactions.
******************************************************************************/
void
Ndb::reportCallback(NdbConnection** aCopyArray, Uint32 aNoOfCompletedTrans)
Ndb::reportCallback(NdbTransaction** aCopyArray, Uint32 aNoOfCompletedTrans)
{
Uint32 i;
if (aNoOfCompletedTrans > 0) {
......@@ -923,7 +922,7 @@ Ndb::reportCallback(NdbConnection** aCopyArray, Uint32 aNoOfCompletedTrans)
NdbAsynchCallback aCallback = aCopyArray[i]->theCallbackFunction;
int tResult = 0;
if (aCallback != NULL) {
if (aCopyArray[i]->theReturnStatus == NdbConnection::ReturnFailure) {
if (aCopyArray[i]->theReturnStatus == NdbTransaction::ReturnFailure) {
tResult = -1;
}//if
(*aCallback)(tResult, aCopyArray[i], anyObject);
......@@ -933,13 +932,13 @@ Ndb::reportCallback(NdbConnection** aCopyArray, Uint32 aNoOfCompletedTrans)
}//Ndb::reportCallback()
/*****************************************************************************
Uint32 pollCompleted(NdbConnection** aCopyArray);
Uint32 pollCompleted(NdbTransaction** aCopyArray);
Remark: Transfer the data from the completed transaction to a local array.
This support is used by a number of the poll-methods.
******************************************************************************/
Uint32
Ndb::pollCompleted(NdbConnection** aCopyArray)
Ndb::pollCompleted(NdbTransaction** aCopyArray)
{
check_send_timeout();
Uint32 i;
......@@ -947,13 +946,13 @@ Ndb::pollCompleted(NdbConnection** aCopyArray)
if (tNoCompletedTransactions > 0) {
for (i = 0; i < tNoCompletedTransactions; i++) {
aCopyArray[i] = theCompletedTransactionsArray[i];
if (aCopyArray[i]->theListState != NdbConnection::InCompletedList) {
if (aCopyArray[i]->theListState != NdbTransaction::InCompletedList) {
ndbout << "pollCompleted error ";
ndbout << (int) aCopyArray[i]->theListState << endl;
abort();
}//if
theCompletedTransactionsArray[i] = NULL;
aCopyArray[i]->theListState = NdbConnection::NotInList;
aCopyArray[i]->theListState = NdbTransaction::NotInList;
}//for
}//if
theNoOfCompletedTransactions = 0;
......@@ -968,7 +967,7 @@ Ndb::check_send_timeout()
the_last_check_time = current_time;
Uint32 no_of_sent = theNoOfSentTransactions;
for (Uint32 i = 0; i < no_of_sent; i++) {
NdbConnection* a_con = theSentTransactionsArray[i];
NdbTransaction* a_con = theSentTransactionsArray[i];
if ((current_time - a_con->theStartTransTime) >
WAITFOR_RESPONSE_TIMEOUT) {
#ifdef VM_TRACE
......@@ -979,8 +978,8 @@ Ndb::check_send_timeout()
abort();
#endif
a_con->setOperationErrorCodeAbort(4012);
a_con->theCommitStatus = NdbConnection::Aborted;
a_con->theCompletionStatus = NdbConnection::CompletedFailure;
a_con->theCommitStatus = NdbTransaction::Aborted;
a_con->theCompletionStatus = NdbTransaction::CompletedFailure;
a_con->handleExecuteCompletion();
remove_sent_list(i);
insert_completed_list(a_con);
......@@ -996,7 +995,7 @@ Ndb::remove_sent_list(Uint32 list_index)
{
Uint32 last_index = theNoOfSentTransactions - 1;
if (list_index < last_index) {
NdbConnection* t_con = theSentTransactionsArray[last_index];
NdbTransaction* t_con = theSentTransactionsArray[last_index];
theSentTransactionsArray[list_index] = t_con;
}//if
theNoOfSentTransactions = last_index;
......@@ -1004,23 +1003,23 @@ Ndb::remove_sent_list(Uint32 list_index)
}
Uint32
Ndb::insert_completed_list(NdbConnection* a_con)
Ndb::insert_completed_list(NdbTransaction* a_con)
{
Uint32 no_of_comp = theNoOfCompletedTransactions;
theCompletedTransactionsArray[no_of_comp] = a_con;
theNoOfCompletedTransactions = no_of_comp + 1;
a_con->theListState = NdbConnection::InCompletedList;
a_con->theListState = NdbTransaction::InCompletedList;
a_con->theTransArrayIndex = no_of_comp;
return no_of_comp;
}
Uint32
Ndb::insert_sent_list(NdbConnection* a_con)
Ndb::insert_sent_list(NdbTransaction* a_con)
{
Uint32 no_of_sent = theNoOfSentTransactions;
theSentTransactionsArray[no_of_sent] = a_con;
theNoOfSentTransactions = no_of_sent + 1;
a_con->theListState = NdbConnection::InSendList;
a_con->theListState = NdbTransaction::InSendList;
a_con->theTransArrayIndex = no_of_sent;
return no_of_sent;
}
......@@ -1052,16 +1051,16 @@ Ndb::sendPrepTrans(int forceSend)
TransporterFacade* tp = TransporterFacade::instance();
Uint32 no_of_prep_trans = theNoOfPreparedTransactions;
for (i = 0; i < no_of_prep_trans; i++) {
NdbConnection * a_con = thePreparedTransactionsArray[i];
NdbTransaction * a_con = thePreparedTransactionsArray[i];
thePreparedTransactionsArray[i] = NULL;
Uint32 node_id = a_con->getConnectedNodeId();
if ((tp->getNodeSequence(node_id) == a_con->theNodeSequence) &&
tp->get_node_alive(node_id) ||
(tp->get_node_stopping(node_id) &&
((a_con->theSendStatus == NdbConnection::sendABORT) ||
(a_con->theSendStatus == NdbConnection::sendABORTfail) ||
(a_con->theSendStatus == NdbConnection::sendCOMMITstate) ||
(a_con->theSendStatus == NdbConnection::sendCompleted)))) {
((a_con->theSendStatus == NdbTransaction::sendABORT) ||
(a_con->theSendStatus == NdbTransaction::sendABORTfail) ||
(a_con->theSendStatus == NdbTransaction::sendCOMMITstate) ||
(a_con->theSendStatus == NdbTransaction::sendCompleted)))) {
/*
We will send if
1) Node is alive and sequences are correct OR
......@@ -1093,13 +1092,13 @@ Ndb::sendPrepTrans(int forceSend)
again and will thus set the state to Aborted to avoid a more or
less eternal loop of tries.
*/
if (a_con->theSendStatus == NdbConnection::sendOperations) {
if (a_con->theSendStatus == NdbTransaction::sendOperations) {
a_con->setOperationErrorCodeAbort(4021);
a_con->theCommitStatus = NdbConnection::NeedAbort;
a_con->theCommitStatus = NdbTransaction::NeedAbort;
TRACE_DEBUG("Send buffer full and sendOperations");
} else {
a_con->setOperationErrorCodeAbort(4026);
a_con->theCommitStatus = NdbConnection::Aborted;
a_con->theCommitStatus = NdbTransaction::Aborted;
TRACE_DEBUG("Send buffer full, set state to Aborted");
}//if
}//if
......@@ -1116,7 +1115,7 @@ Ndb::sendPrepTrans(int forceSend)
*/
TRACE_DEBUG("Abort a transaction when stopping a node");
a_con->setOperationErrorCodeAbort(4023);
a_con->theCommitStatus = NdbConnection::NeedAbort;
a_con->theCommitStatus = NdbTransaction::NeedAbort;
} else {
/*
The node is hard dead and we cannot continue. We will also release
......@@ -1126,11 +1125,11 @@ Ndb::sendPrepTrans(int forceSend)
a_con->setOperationErrorCodeAbort(4025);
a_con->theReleaseOnClose = true;
a_con->theTransactionIsStarted = false;
a_con->theCommitStatus = NdbConnection::Aborted;
a_con->theCommitStatus = NdbTransaction::Aborted;
}//if
}//if
a_con->theReturnStatus = NdbConnection::ReturnFailure;
a_con->theCompletionStatus = NdbConnection::CompletedFailure;
a_con->theReturnStatus = NdbTransaction::ReturnFailure;
a_con->theCompletionStatus = NdbTransaction::CompletedFailure;
a_con->handleExecuteCompletion();
insert_completed_list(a_con);
}//for
......@@ -1204,7 +1203,7 @@ Remark: First send all prepared operations and then check if there are any
int
Ndb::sendPollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup, int forceSend)
{
NdbConnection* tConArray[1024];
NdbTransaction* tConArray[1024];
Uint32 tNoCompletedTransactions;
//theCurrentConnectCounter = 0;
......@@ -1237,7 +1236,7 @@ Remark: Check if there are any transactions already completed. Wait for not
int
Ndb::pollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup)
{
NdbConnection* tConArray[1024];
NdbTransaction* tConArray[1024];
Uint32 tNoCompletedTransactions;
//theCurrentConnectCounter = 0;
......@@ -1344,7 +1343,7 @@ Ndb::sendRecSignal(Uint16 node_id,
}//Ndb::sendRecSignal()
void
NdbConnection::sendTC_COMMIT_ACK(NdbApiSignal * aSignal,
NdbTransaction::sendTC_COMMIT_ACK(NdbApiSignal * aSignal,
Uint32 transId1, Uint32 transId2,
Uint32 aTCRef){
#ifdef MARKER_TRACE
......
......@@ -19,12 +19,12 @@
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
#include "NdbOperation.hpp"
#include "NdbConnection.hpp"
#include "NdbRecAttr.hpp"
#include "IPCConfig.hpp"
#include <NdbOperation.hpp>
#include <NdbTransaction.hpp>
#include <NdbRecAttr.hpp>
#include <IPCConfig.hpp>
#include "TransporterFacade.hpp"
#include "ConfigRetriever.hpp"
#include <ConfigRetriever.hpp>
#include <ndb_limits.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
......
......@@ -19,7 +19,6 @@
#include <NdbOperation.hpp>
#include <NdbIndexOperation.hpp>
#include <NdbIndexScanOperation.hpp>
#include <NdbConnection.hpp>
#include "NdbApiSignal.hpp"
#include <NdbRecAttr.hpp>
#include "NdbUtil.hpp"
......@@ -43,10 +42,10 @@ Ndb::checkFailedNode()
/**
* Release all connections in idle list (for node)
*/
NdbConnection * tNdbCon = theConnectionArray[node_id];
NdbTransaction * tNdbCon = theConnectionArray[node_id];
theConnectionArray[node_id] = NULL;
while (tNdbCon != NULL) {
NdbConnection* tempNdbCon = tNdbCon;
NdbTransaction* tempNdbCon = tNdbCon;
tNdbCon = tNdbCon->next();
releaseNdbCon(tempNdbCon);
}
......@@ -88,14 +87,14 @@ NdbImpl::checkErrorCode(Uint32 i, NdbTableImpl * tab){
* if createConIdleList was succesful
* Return -1: In all other case.
* Parameters: aNrOfCon : Number of connections offered to the application.
* Remark: Create connection idlelist with NdbConnection objects.
* Remark: Create connection idlelist with NdbTransaction objects.
***************************************************************************/
int
Ndb::createConIdleList(int aNrOfCon)
{
for (int i = 0; i < aNrOfCon; i++)
{
NdbConnection* tNdbCon = new NdbConnection(this);
NdbTransaction* tNdbCon = new NdbTransaction(this);
if (tNdbCon == NULL)
{
return -1;
......@@ -109,7 +108,7 @@ Ndb::createConIdleList(int aNrOfCon)
tNdbCon->next(theConIdleList);
theConIdleList = tNdbCon;
}
tNdbCon->Status(NdbConnection::NotConnected);
tNdbCon->Status(NdbTransaction::NotConnected);
}
theNoOfAllocatedTransactions = aNrOfCon;
return aNrOfCon;
......@@ -200,19 +199,19 @@ Ndb::getNdbCall()
}
/***************************************************************************
* NdbConnection* getNdbCon();
* NdbTransaction* getNdbCon();
*
* Return Value: Return a connection if the getNdbCon was successful.
* Return NULL : In all other case.
* Remark: Get a connection from theConIdleList and return the object .
***************************************************************************/
NdbConnection*
NdbTransaction*
Ndb::getNdbCon()
{
NdbConnection* tNdbCon;
NdbTransaction* tNdbCon;
if ( theConIdleList == NULL ) {
if (theNoOfAllocatedTransactions < theMaxNoOfTransactions) {
tNdbCon = new NdbConnection(this);
tNdbCon = new NdbTransaction(this);
if (tNdbCon == NULL) {
return NULL;
}//if
......@@ -484,13 +483,13 @@ Ndb::releaseNdbCall(NdbCall* aNdbCall)
}
/***************************************************************************
void releaseNdbCon(NdbConnection* aNdbCon);
void releaseNdbCon(NdbTransaction* aNdbCon);
Parameters: aNdbCon: The NdbConnection object.
Parameters: aNdbCon: The NdbTransaction object.
Remark: Add a Connection object into the signal idlelist.
***************************************************************************/
void
Ndb::releaseNdbCon(NdbConnection* aNdbCon)
Ndb::releaseNdbCon(NdbTransaction* aNdbCon)
{
aNdbCon->next(theConIdleList);
aNdbCon->theMagicNumber = 0xFE11DD;
......@@ -720,7 +719,7 @@ Remark: Always release the first item in the free list
void
Ndb::freeNdbCon()
{
NdbConnection* tNdbCon = theConIdleList;
NdbTransaction* tNdbCon = theConIdleList;
theConIdleList = theConIdleList->next();
delete tNdbCon;
}
......@@ -789,14 +788,14 @@ Ndb::freeNdbBlob()
}
/****************************************************************************
int releaseConnectToNdb(NdbConnection* aConnectConnection);
int releaseConnectToNdb(NdbTransaction* aConnectConnection);
Return Value: -1 if error
Parameters: aConnectConnection : Seized schema connection to DBTC
Remark: Release and disconnect from DBTC a connection and seize it to theConIdleList.
*****************************************************************************/
void
Ndb::releaseConnectToNdb(NdbConnection* a_con)
Ndb::releaseConnectToNdb(NdbTransaction* a_con)
{
DBUG_ENTER("Ndb::releaseConnectToNdb");
NdbApiSignal tSignal(theMyRef);
......@@ -814,7 +813,7 @@ Ndb::releaseConnectToNdb(NdbConnection* a_con)
tSignal.setData((tConPtr = a_con->getTC_ConnectPtr()), 1);
tSignal.setData(theMyRef, 2);
tSignal.setData(a_con->ptr2int(), 3);
a_con->Status(NdbConnection::DisConnecting);
a_con->Status(NdbTransaction::DisConnecting);
a_con->theMagicNumber = 0x37412619;
int ret_code = sendRecSignal(node_id,
WAIT_TC_RELEASE,
......
......@@ -22,7 +22,7 @@
struct restore_callback_t {
class BackupRestore *restore;
class TupleS tup;
class NdbConnection *connection;
class NdbTransaction *connection;
int retries;
int error_code;
restore_callback_t *next;
......
......@@ -29,7 +29,7 @@
class Ndb; // Forward declaration
class NdbOperation; // Forward declaration
class NdbConnection; // Forward declaration
class NdbTransaction; // Forward declaration
class NdbRecAttr; // Forward declaration
class NdbScanOperation;
class NdbIndexScanOperation;
......@@ -210,7 +210,7 @@ class ha_ndbcluster: public handler
void print_results();
ulonglong get_auto_increment();
int ndb_err(NdbConnection*);
int ndb_err(NdbTransaction*);
bool uses_blob_value(bool all_fields);
int write_ndb_file();
......@@ -218,7 +218,7 @@ class ha_ndbcluster: public handler
private:
int check_ndb_connection();
NdbConnection *m_active_trans;
NdbTransaction *m_active_trans;
NdbScanOperation *m_active_cursor;
Ndb *m_ndb;
void *m_table;
......@@ -271,9 +271,9 @@ class ha_ndbcluster: public handler
void no_uncommitted_rows_init(THD *);
void no_uncommitted_rows_reset(THD *);
friend int execute_no_commit(ha_ndbcluster*, NdbConnection*);
friend int execute_commit(ha_ndbcluster*, NdbConnection*);
friend int execute_no_commit_ie(ha_ndbcluster*, NdbConnection*);
friend int execute_no_commit(ha_ndbcluster*, NdbTransaction*);
friend int execute_commit(ha_ndbcluster*, NdbTransaction*);
friend int execute_no_commit_ie(ha_ndbcluster*, NdbTransaction*);
};
bool ndbcluster_init(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment