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