summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ndb/BinDist.sh1
-rw-r--r--ndb/include/ndbapi/Ndb.hpp58
-rw-r--r--ndb/include/ndbapi/NdbApi.hpp4
-rw-r--r--ndb/include/ndbapi/NdbConnection.hpp83
-rw-r--r--ndb/include/ndbapi/NdbIndexOperation.hpp2
-rw-r--r--ndb/include/ndbapi/NdbOperation.hpp78
-rw-r--r--ndb/include/ndbapi/NdbRecAttr.hpp36
-rw-r--r--ndb/include/ndbapi/NdbSchemaCon.hpp25
-rw-r--r--ndb/include/ndbapi/NdbSchemaOp.hpp185
-rw-r--r--ndb/include/ndbapi/ndbapi_limits.h19
-rw-r--r--ndb/src/Makefile1
-rw-r--r--ndb/src/kernel/blocks/backup/restore/Restore.hpp4
-rw-r--r--ndb/src/kernel/blocks/backup/restore/main.cpp7
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp1
-rw-r--r--ndb/src/ndbapi/ClusterMgr.cpp1
-rw-r--r--ndb/src/ndbapi/Ndb.cpp15
-rw-r--r--ndb/src/ndbapi/NdbApiSignal.cpp1
-rw-r--r--ndb/src/ndbapi/NdbApiSignal.hpp1
-rw-r--r--ndb/src/ndbapi/NdbConnection.cpp2
-rw-r--r--ndb/src/ndbapi/NdbDictionaryImpl.cpp3
-rw-r--r--ndb/src/ndbapi/NdbEventOperationImpl.cpp103
-rw-r--r--ndb/src/ndbapi/NdbIndexOperation.cpp6
-rw-r--r--ndb/src/ndbapi/NdbOperation.cpp4
-rw-r--r--ndb/src/ndbapi/NdbOperationDefine.cpp1
-rw-r--r--ndb/src/ndbapi/NdbOperationExec.cpp2
-rw-r--r--ndb/src/ndbapi/NdbOperationInt.cpp13
-rw-r--r--ndb/src/ndbapi/NdbOperationScan.cpp8
-rw-r--r--ndb/src/ndbapi/NdbOperationSearch.cpp3
-rw-r--r--ndb/src/ndbapi/NdbResultSet.cpp12
-rw-r--r--ndb/src/ndbapi/NdbSchemaCon.cpp23
-rw-r--r--ndb/src/ndbapi/NdbSchemaOp.cpp21
-rw-r--r--ndb/src/ndbapi/NdbUtil.hpp1
-rw-r--r--ndb/src/ndbapi/Ndbif.cpp94
-rw-r--r--ndb/src/ndbapi/Ndbinit.cpp12
-rw-r--r--ndb/src/ndbapi/Ndblist.cpp8
-rw-r--r--ndb/src/ndbapi/TransporterFacade.cpp1
-rw-r--r--ndb/src/ndbapi/TransporterFacade.hpp7
-rw-r--r--ndb/test/include/NDBT_Table.hpp69
-rw-r--r--ndb/test/ndbapi/acid/acid.cpp15
-rw-r--r--ndb/test/ndbapi/flexAsynch/flexAsynch.cpp9
-rw-r--r--ndb/test/ndbapi/flexScan/flexScan.cpp25
-rw-r--r--ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp45
-rw-r--r--ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp61
-rw-r--r--ndb/test/ndbapi/ronja/initronja/initronja.cpp11
-rw-r--r--ndb/test/ndbapi/telco/msa.cpp6
-rw-r--r--ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp6
-rw-r--r--ndb/test/ndbapi/testNdbApi/testNdbApi.cpp4
-rw-r--r--ndb/test/ndbapi/testRestartGci/testRestartGci.cpp2
-rw-r--r--ndb/test/src/NDBT_ResultRow.cpp12
-rw-r--r--ndb/test/src/NDBT_Table.cpp40
-rw-r--r--ndb/test/src/UtilTransactions.cpp4
-rw-r--r--ndb/tools/desc/desc.cpp45
52 files changed, 694 insertions, 506 deletions
diff --git a/ndb/BinDist.sh b/ndb/BinDist.sh
index 2f9620549f4..3574b0d64ce 100644
--- a/ndb/BinDist.sh
+++ b/ndb/BinDist.sh
@@ -50,7 +50,6 @@ include/mgmapi/mgmapi.h
include/mgmapi/mgmapi_debug.h
include/ndbapi/
include/ndbapi/ndbapi_limits.h
-include/ndbapi/AttrType.hpp
include/ndbapi/Ndb.hpp
include/ndbapi/NdbApi.hpp
include/ndbapi/NdbConnection.hpp
diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp
index fd6e827ceb4..3acfcd194e8 100644
--- a/ndb/include/ndbapi/Ndb.hpp
+++ b/ndb/include/ndbapi/Ndb.hpp
@@ -860,7 +860,6 @@
#include <ndb_types.h>
#include <ndbapi_limits.h>
-#include <AttrType.hpp>
#include <NdbError.hpp>
#include <NdbDictionary.hpp>
@@ -870,8 +869,6 @@ class NdbEventOperationImpl;
class NdbScanOperation;
class NdbIndexOperation;
class NdbConnection;
-class NdbSchemaOp;
-class NdbSchemaCon;
class NdbApiSignal;
class NdbRecAttr;
class NdbLabel;
@@ -961,8 +958,6 @@ class Ndb
friend class NdbOperation;
friend class NdbEventOperationImpl;
friend class NdbConnection;
- friend class NdbSchemaOp;
- friend class NdbSchemaCon;
friend class Table;
friend class NdbApiSignal;
friend class NdbScanReceiver;
@@ -1064,8 +1059,6 @@ public:
* A value larger than 1024 will be downgraded to 1024.
* This means that one Ndb object can handle at most 1024 parallel
* transactions.
- * There is a maximum of 128 simultaneous
- * Ndb object within one application process.
* @return 0 if successful, -1 otherwise.
*
* @note The internal implementation multiplies this value
@@ -1245,22 +1238,6 @@ public:
*/
void closeTransaction(NdbConnection* aConnection);
-#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
- /**
- * To create a table it is necessary to obtain a schema transaction
- * object.
- * All schema transactions need to closed when they are
- * completed.
- *
- * @return NdbSchemaCon
- */
- NdbSchemaCon* startSchemaTransaction();
-
- /**
- * Close schema transaction when finished.
- */
- void closeSchemaTransaction(NdbSchemaCon* aSchemaCon);
-#endif
/** @} *********************************************************************/
@@ -1391,6 +1368,20 @@ public:
/** @} *********************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+
+ /**
+ * Different types of tampering with the NDB Cluster.
+ * <b>Only for debugging purposes only.</b>
+ */
+ enum TamperType {
+ LockGlbChp = 1, ///< Lock GCP
+ UnlockGlbChp, ///< Unlock GCP
+ CrashNode, ///< Crash an NDB node
+ ReadRestartGCI, ///< Request the restart GCI id from NDB Cluster
+ InsertError ///< Execute an error in NDB Cluster
+ ///< (may crash system)
+ };
+
/**
* For testing purposes it is possible to tamper with the NDB Cluster
* (i.e. send a special signal to DBDIH, the NDB distribution handler).
@@ -1398,14 +1389,7 @@ public:
* In a release versions of NDB Cluster,
* this call always return -1 and does nothing.
*
- * @param aAction Action to be taken
- * - 1: Lock global checkpointing
- * (Can only be sent to master DIH,
- * Parameter aNode ignored).
- * - 2: UnLock global checkpointing
- * (Can only be sent to master DIH,
- * Parameter aNode ignored).
- * - 3: Crash node.
+ * @param aAction Action to be taken according to TamperType above
*
* @param aNode Which node the action will be taken
* -1: Master DIH.
@@ -1616,9 +1600,6 @@ private:
NdbScanOperation* theScanOpIdleList; // First scan operation in the idle list.
NdbIndexOperation* theIndexOpIdleList; // First index operation in the idle list.
- NdbSchemaCon* theSchemaConIdleList; // First schemaCon in idle list.
-
- NdbSchemaCon* theSchemaConToNdbList; // Connected schemaCon object.
NdbConnection* theTransactionList;
NdbConnection** theConnectionArray;
NdbRecAttr* theRecAttrIdleList;
@@ -1649,7 +1630,14 @@ private:
NdbError theError;
Int32 theNdbBlockNumber;
- InitType theInitState;
+
+ enum InitType {
+ NotConstructed,
+ NotInitialised,
+ StartingInit,
+ Initialised,
+ InitConfigError
+ } theInitState;
// Ensure good distribution of connects
Uint32 theCurrentConnectIndex;
diff --git a/ndb/include/ndbapi/NdbApi.hpp b/ndb/include/ndbapi/NdbApi.hpp
index e5efc9756ce..b9b52708789 100644
--- a/ndb/include/ndbapi/NdbApi.hpp
+++ b/ndb/include/ndbapi/NdbApi.hpp
@@ -17,14 +17,12 @@
#ifndef NdbApi_H
#define NdbApi_H
+#include "ndbapi_limits.h"
#include "Ndb.hpp"
-#include "AttrType.hpp"
#include "NdbConnection.hpp"
#include "NdbOperation.hpp"
#include "NdbScanOperation.hpp"
#include "NdbIndexOperation.hpp"
-#include "NdbSchemaCon.hpp"
-#include "NdbSchemaOp.hpp"
#include "NdbRecAttr.hpp"
#include "NdbResultSet.hpp"
#include "NdbDictionary.hpp"
diff --git a/ndb/include/ndbapi/NdbConnection.hpp b/ndb/include/ndbapi/NdbConnection.hpp
index c775dd5e33d..89786f63cc5 100644
--- a/ndb/include/ndbapi/NdbConnection.hpp
+++ b/ndb/include/ndbapi/NdbConnection.hpp
@@ -18,7 +18,6 @@
#define NdbConnection_H
#include <ndb_types.h>
-#include <AttrType.hpp>
#include <NdbError.hpp>
class NdbConnection;
@@ -41,6 +40,35 @@ class NdbScanReceiver;
typedef void (* NdbAsynchCallback)(int, NdbConnection*, void*);
/**
+ * Commit type of transaction
+ */
+enum AbortOption {
+#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+ CommitIfFailFree = 0,
+ CommitAsMuchAsPossible = 2, ///< Commit transaction with as many
+ TryCommit = 0, ///< <i>Missing explanation</i>
+#endif
+ AbortOnError = 0, ///< Abort transaction on failed operation
+ IgnoreError = 2 ///< Transaction continues on failed operation
+};
+
+typedef AbortOption CommitType;
+
+
+/**
+ * Execution type of transaction
+ */
+enum ExecType {
+ NoExecTypeDef = -1, ///< Erroneous type (Used for debugging only)
+ Prepare, ///< <i>Missing explanation</i>
+ NoCommit, ///< Execute the transaction as far as it has
+ ///< been defined, but do not yet commit it
+ Commit, ///< Execute and try to commit the transaction
+ Rollback ///< Rollback transaction
+};
+
+
+/**
* @class NdbConnection
* @brief Represents a transaction.
*
@@ -419,6 +447,14 @@ public:
* @return The commit status of the transaction, i.e. one of
* { NotStarted, Started, TimeOut, Committed, Aborted, NeedAbort }
*/
+ enum CommitStatusType {
+ NotStarted, ///< Transaction not yet started
+ Started, ///< <i>Missing explanation</i>
+ Committed, ///< Transaction has been committed
+ Aborted, ///< Transaction has been aborted
+ NeedAbort ///< <i>Missing explanation</i>
+ };
+
CommitStatusType commitStatus();
/** @} *********************************************************************/
@@ -515,8 +551,17 @@ private:
Uint32 getBuddyConPtr(); // Gets Buddy Con Ptr
NdbConnection* next(); // Returns the next pointer
void next(NdbConnection*); // Sets the next pointer
- ConStatusType Status(); // Read the status information
- void Status(ConStatusType); // Set the status information
+
+ enum ConStatusType {
+ NotConnected,
+ Connecting,
+ Connected,
+ DisConnecting,
+ ConnectFailure
+ };
+ ConStatusType Status(); // Read the status information
+ void Status(ConStatusType); // Set the status information
+
Uint32 get_send_size(); // Get size to send
void set_send_size(Uint32); // Set size to send;
@@ -595,6 +640,18 @@ private:
Uint32 theId;
// Keeps track of what the send method should do.
+ enum SendStatusType {
+ NotInit,
+ InitState,
+ sendOperations,
+ sendCompleted,
+ sendCOMMITstate,
+ sendABORT,
+ sendABORTfail,
+ sendTC_ROLLBACK,
+ sendTC_COMMIT,
+ sendTC_OP
+ };
SendStatusType theSendStatus;
NdbAsynchCallback theCallbackFunction; // Pointer to the callback function
void* theCallbackObject; // The callback object pointer
@@ -628,12 +685,18 @@ private:
Uint64 theTransactionId; // theTransactionId of the transaction
Uint32 theGlobalCheckpointId; // The gloabl checkpoint identity of the transaction
ConStatusType theStatus; // The status of the connection
-
- CompletionStatus theCompletionStatus; // The Completion status of the transaction
+ enum CompletionStatus {
+ NotCompleted,
+ CompletedSuccess,
+ CompletedFailure,
+ DefinitionFailure
+ } theCompletionStatus; // The Completion status of the transaction
CommitStatusType theCommitStatus; // The commit status of the transaction
Uint32 theMagicNumber; // Magic Number to verify correct object
Uint32 thePriority; // Transaction Priority
+
+ enum ReturnType { ReturnSuccess, ReturnFailure };
ReturnType theReturnStatus; // Did we have any read/update/delete failing
// to find the tuple.
bool theTransactionIsStarted;
@@ -641,7 +704,12 @@ private:
bool theSimpleState;
Uint8 m_abortOption; // Type of commit
- ListState theListState;
+ enum ListState {
+ NotInList,
+ InPreparedList,
+ InSendList,
+ InCompletedList
+ } theListState;
Uint32 theDBnode; // The database node we are connected to
Uint32 theNodeSequence; // The sequence no of the db node
@@ -830,7 +898,7 @@ Parameters: aStatus: The status.
Remark: Sets Connect status.
******************************************************************************/
inline
-ConStatusType
+NdbConnection::ConStatusType
NdbConnection::Status()
{
return theStatus;
@@ -849,6 +917,7 @@ NdbConnection::Status( ConStatusType aStatus )
theStatus = aStatus;
}
+
/******************************************************************************
void setGCI();
diff --git a/ndb/include/ndbapi/NdbIndexOperation.hpp b/ndb/include/ndbapi/NdbIndexOperation.hpp
index 3b8e5f7a888..baf31dca0ee 100644
--- a/ndb/include/ndbapi/NdbIndexOperation.hpp
+++ b/ndb/include/ndbapi/NdbIndexOperation.hpp
@@ -184,7 +184,7 @@ private:
// Private attributes
NdbIndexImpl* m_theIndex;
- Uint32 m_theIndexDefined[MAXNROFTUPLEKEY][3];
+ Uint32 m_theIndexDefined[NDB_MAX_ATTRIBUTES_IN_INDEX][3];
Uint32 m_theIndexLen; // Length of the index in words
Uint32 m_theNoOfIndexDefined; // The number of index attributes
};
diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp
index 3c515fe84ef..e772a30f571 100644
--- a/ndb/include/ndbapi/NdbOperation.hpp
+++ b/ndb/include/ndbapi/NdbOperation.hpp
@@ -18,10 +18,9 @@
#define NdbOperation_H
#include <ndb_types.h>
-
-#include <AttrType.hpp>
-#include <NdbError.hpp>
-#include <NdbReceiver.hpp>
+#include "ndbapi_limits.h"
+#include "NdbError.hpp"
+#include "NdbReceiver.hpp"
class Ndb;
class NdbApiSignal;
@@ -835,6 +834,22 @@ public:
/** @} *********************************************************************/
+ /**
+ * Type of operation
+ */
+ enum OperationType {
+ ReadRequest = 0, ///< Read operation
+ UpdateRequest = 1, ///< Update Operation
+ InsertRequest = 2, ///< Insert Operation
+ DeleteRequest = 3, ///< Delete Operation
+ WriteRequest = 4, ///< Write Operation
+ ReadExclusive = 5, ///< Read exclusive
+ OpenScanRequest, ///< Scan Operation
+ OpenRangeScanRequest, ///< Range scan operation
+ NotDefined2, ///< Internal for debugging
+ NotDefined ///< Internal for debugging
+ };
+
protected:
/******************************************************************************
* These are the methods used to create and delete the NdbOperation objects.
@@ -865,11 +880,27 @@ protected:
NdbOperation* next(); // Get next pointer
+ enum OperationStatus{
+ Init,
+ OperationDefined,
+ TupleKeyDefined,
+ GetValue,
+ SetValue,
+ ExecInterpretedValue,
+ SetValueInterpreted,
+ FinalGetValue,
+ SubroutineExec,
+ SubroutineEnd,
+ SetBound,
+ WaitResponse,
+ WaitCommitResponse,
+ Finished,
+ ReceiveFinished
+ };
+
OperationStatus Status(); // Read the status information
void Status(OperationStatus); // Set the status information
-
- OperationType RequestType();
void NdbCon(NdbConnection*); // Set reference to connection
// object.
@@ -879,8 +910,6 @@ protected:
// the operations object.
void setStartIndicator();
- void setCommitIndicator(CommitType aCommitType);
-
/******************************************************************************
* The methods below is the execution part of the NdbOperation
* class. This is where the NDB signals are sent and received. The
@@ -1013,18 +1042,13 @@ protected:
Uint32 theCurrRecAI_Len; // The currently received length
Uint32 theAI_ElementLen; // How many words long is this element
Uint32* theCurrElemPtr; // The current pointer to the element
- //Uint32 theTableId; // Table id.
- //Uint32 theAccessTableId; // The id of table for initial access,
- // changed by NdbIndexOperation
- //Uint32 theSchemaVersion; // The schema version on the table.
class NdbTableImpl* m_currentTable; // The current table
class NdbTableImpl* m_accessTable;
// Set to TRUE when a tuple key attribute has been defined.
- // A tuple key is allowed to consist of 64 attributes.
- Uint32 theTupleKeyDefined[MAXNROFTUPLEKEY][3];
+ Uint32 theTupleKeyDefined[NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY][3];
- Uint32 theTotalNrOfKeyWordInSignal; // The total number of
+ Uint32 theTotalNrOfKeyWordInSignal; // The total number of
// keyword in signal.
Uint32 theTupKeyLen; // Length of the tuple key in words
@@ -1094,16 +1118,6 @@ NdbOperation::setStartIndicator()
theStartIndicator = 1;
}
-#if 0
-inline
-void
-NdbOperation::setCommitIndicator(CommitType aTypeOfCommit)
-{
- theCommitIndicator = 1;
- theCommitType = (Uint8)aTypeOfCommit;
-}
-#endif
-
inline
int
NdbOperation::getNdbErrorLine()
@@ -1145,7 +1159,7 @@ Parameters: aStatus: The status.
Remark: Sets Operation status.
******************************************************************************/
inline
-OperationStatus
+NdbOperation::OperationStatus
NdbOperation::Status()
{
return theStatus;
@@ -1178,18 +1192,6 @@ NdbOperation::NdbCon(NdbConnection* aNdbCon)
theNdbCon = aNdbCon;
}
-/******************************************************************************
-OperationType RequestType();
-
-Remark: Return the request typ of the operation..
-******************************************************************************/
-inline
-OperationType
-NdbOperation::RequestType()
-{
- return theOperationType;
-}
-
inline
int
NdbOperation::equal(const char* anAttrName, Int32 aPar)
diff --git a/ndb/include/ndbapi/NdbRecAttr.hpp b/ndb/include/ndbapi/NdbRecAttr.hpp
index 7eeff88671d..0960c035abe 100644
--- a/ndb/include/ndbapi/NdbRecAttr.hpp
+++ b/ndb/include/ndbapi/NdbRecAttr.hpp
@@ -18,7 +18,6 @@
#define NdbRecAttr_H
#include <NdbDictionary.hpp>
-#include "AttrType.hpp"
class NdbOperation;
class AttrInfo;
@@ -85,13 +84,11 @@ public:
* @{
*/
const NdbDictionary::Column * getColumn() const;
-
+
/**
- * Get attribute type.
- *
- * @return Type of attribute: { Signed, UnSigned, Float, String }
+ * Get type of column
+ * @return Data type of the column
*/
- AttrType attrType() const ;
NdbDictionary::Column::Type getType() const;
/**
@@ -317,33 +314,6 @@ NdbRecAttr::attrSize() const {
}
inline
-AttrType
-NdbRecAttr::attrType() const {
- switch(getType()){
- case NdbDictionary::Column::Bigint:
- case NdbDictionary::Column::Int:
- return Signed;
- case NdbDictionary::Column::Bigunsigned:
- case NdbDictionary::Column::Unsigned:
- return UnSigned;
- case NdbDictionary::Column::Float:
- case NdbDictionary::Column::Decimal:
- case NdbDictionary::Column::Double:
- return Float;
- case NdbDictionary::Column::Char:
- case NdbDictionary::Column::Varchar:
- case NdbDictionary::Column::Binary:
- case NdbDictionary::Column::Varbinary:
- return String;
- case NdbDictionary::Column::Datetime:
- case NdbDictionary::Column::Timespec:
- case NdbDictionary::Column::Undefined:
- default:
- return NoAttrTypeDef;
- }
-}
-
-inline
Uint32
NdbRecAttr::arraySize() const
{
diff --git a/ndb/include/ndbapi/NdbSchemaCon.hpp b/ndb/include/ndbapi/NdbSchemaCon.hpp
index 9d6b49df8f9..313daf0094b 100644
--- a/ndb/include/ndbapi/NdbSchemaCon.hpp
+++ b/ndb/include/ndbapi/NdbSchemaCon.hpp
@@ -16,15 +16,16 @@
#ifndef NdbSchemaCon_H
#define NdbSchemaCon_H
+
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
#include <ndb_types.h>
-#include "AttrType.hpp"
#include "NdbError.hpp"
+#include <NdbSchemaOp.hpp>
class NdbSchemaOp;
-class NdbApiSignal;
class Ndb;
+class NdbApiSignal;
/**
* @class NdbSchemaCon
@@ -44,6 +45,7 @@ class Ndb;
* into the database.
*
* @note Currently only one table can be added per transaction.
+ * @note Depricated, use NdbDictionary
*/
class NdbSchemaCon
{
@@ -51,6 +53,18 @@ friend class Ndb;
friend class NdbSchemaOp;
public:
+
+ static
+ NdbSchemaCon* startSchemaTrans(Ndb* pNdb){
+ return new NdbSchemaCon(pNdb);
+ }
+
+ static
+ void closeSchemaTrans(NdbSchemaCon* pSchCon){
+ delete pSchCon;
+ }
+
+
/**
* Execute a schema transaction.
*
@@ -75,6 +89,7 @@ public:
const NdbError & getNdbError() const;
private:
+
/******************************************************************************
* These are the create and delete methods of this class.
*****************************************************************************/
@@ -85,8 +100,6 @@ private:
/******************************************************************************
* These are the private methods of this class.
*****************************************************************************/
- void init(); // Initialise connection object for new
- // transaction.
void release(); // Release all schemaop in schemaCon
@@ -105,7 +118,6 @@ private:
int receiveDROP_INDX_REF(NdbApiSignal*);
-
/*****************************************************************************
* These are the private variables of this class.
*****************************************************************************/
@@ -126,6 +138,9 @@ NdbSchemaCon::checkMagicNumber()
return -1;
return 0;
}//NdbSchemaCon::checkMagicNumber()
+
+
+
#endif
#endif
diff --git a/ndb/include/ndbapi/NdbSchemaOp.hpp b/ndb/include/ndbapi/NdbSchemaOp.hpp
index c3a3827a6b4..43f76c8c253 100644
--- a/ndb/include/ndbapi/NdbSchemaOp.hpp
+++ b/ndb/include/ndbapi/NdbSchemaOp.hpp
@@ -16,14 +16,126 @@
#ifndef NdbSchemaOp_H
#define NdbSchemaOp_H
+
+#include <NdbDictionary.hpp>
+
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
-#include "NdbDictionary.hpp"
-#include "AttrType.hpp"
-#include "NdbSchemaCon.hpp"
+ /**
+ * Type of attribute
+ *
+ * NOTE! AttrType is deprecated, use NdbDictionary::Column::Type instead!
+ */
+ enum AttrType {
+ Signed, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::int64_value,
+ ///< NdbRecAttr::int32_value,
+ ///< NdbRecAttr::short_value,
+ ///< NdbRecAttr::char_value
+ UnSigned, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::u_64_value,
+ ///< NdbRecAttr::u_32_value,
+ ///< NdbRecAttr::u_short_value,
+ ///< NdbRecAttr::u_char_value
+ Float, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::float_value and
+ ///< NdbRecAttr::double_value
+ String, ///< Attributes of this type can be read with:
+ ///< NdbRecAttr::aRef,
+ ///< NdbRecAttr::getAttributeObject
+ NoAttrTypeDef ///< Used for debugging only
+ };
+
+
+ /**
+ * @deprecated
+ */
+ enum NullAttributeType {
+ NoNullTypeDefined = -1,
+ NotNullAttribute,
+ NullAttribute,
+ AttributeDefined
+ };
+ /**
+ * Indicates whether the attribute is part of a primary key or not
+ */
+ enum KeyType {
+ Undefined = -1, ///< Used for debugging only
+ NoKey, ///< Attribute is not part of primary key
+ ///< or tuple identity
+ TupleKey, ///< Attribute is part of primary key
+ TupleId ///< Attribute is part of tuple identity
+ ///< (This type of attribute is created
+ ///< internally, and should not be
+ ///< manually created.)
+ };
+ /**
+ * Indicate whether the attribute should be stored on disk or not
+ */
+ enum StorageMode {
+ MMBased = 0, ///< Main memory
+ DiskBased = 1, ///< Disk (Not yet supported.)
+ NoStorageTypeDef ///< Used for debugging only
+ };
+
+ /**
+ * Where attribute is stored.
+ *
+ * This is used to indicate whether a primary key
+ * should only be stored in the index storage and not in the data storage
+ * or if it should be stored in both places.
+ * The first alternative makes the attribute take less space,
+ * but makes it impossible to scan using attribute.
+ *
+ * @note Use NormalStorageAttribute for most cases.
+ * (IndexStorageAttribute should only be used on primary key
+ * attributes and only if you do not want to scan using the attribute.)
+ */
+ enum StorageAttributeType {
+ NoStorageAttributeTypeDefined = -1, ///< <i>Missing explanation</i>
+ IndexStorageAttribute, ///< Attribute is only stored in
+ ///< index storage (ACC)
+ NormalStorageAttribute ///< Attribute values are stored
+ ///< both in the index (ACC) and
+ ///< in the data storage (TUP)
+ };
+
+
+ /**
+ * Type of fragmentation used for a table
+ */
+ enum FragmentType {
+ Default = 0, ///< (All is default!)
+ Single = 1, ///< Only one fragment
+ All = 2, ///< Default value. One fragment per node group
+ DistributionGroup = 3, ///< Distribution Group used for fragmentation.
+ ///< One fragment per node group
+ DistributionKey = 4, ///< Distribution Key used for fragmentation.
+ ///< One fragment per node group.
+ AllLarge = 5, ///< Sixten fragments per node group.
+ DGroupLarge = 6, ///< Distribution Group used for fragmentation.
+ ///< Sixten fragments per node group
+ DKeyLarge = 7 ///< Distribution Key used for fragmentation.
+ ///< Sixten fragments per node group
+ };
+
+ /**
+ * Type of table or index.
+ */
+ enum TableType {
+ UndefTableType = 0,
+ SystemTable = 1, ///< Internal.Table cannot be updated by user
+ UserTable = 2, ///< Normal application table
+ UniqueHashIndex = 3, ///< Unique un-ordered hash index
+ HashIndex = 4, ///< Non-unique un-ordered hash index
+ UniqueOrderedIndex = 5, ///< Unique ordered index
+ OrderedIndex = 6 ///< Non-unique ordered index
+ };
+
-class NdbApiSignal;
+class NdbSchemaCon;
class Ndb;
+
/**
* @class NdbSchemaOp
@@ -41,8 +153,10 @@ class NdbSchemaOp
{
friend class Ndb;
friend class NdbSchemaCon;
-
+
public:
+
+
/**
* Create a new table in the database.
*
@@ -184,7 +298,6 @@ public:
int aMemoryType = 1,
bool aStoredTable = true);
-#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
* This is the old function declaration, don't use.
*
@@ -211,7 +324,6 @@ public:
aMemoryType,
(aStoredTable == 1 ? true : false));
}
-#endif
/**
* Add a new attribute to a database table.
@@ -367,7 +479,6 @@ public:
bool aAutoIncrement = false,
const char* aDefaultValue = 0);
-#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
* @deprecated do not use!
*/
@@ -394,19 +505,8 @@ public:
aDistributionGroup,
aDistributionGroupNoOfBits);
}
-#endif
-
- /**
- * Get the last error which occurred during the transaction.
- *
- * If an error occured (NdbSchemaCon::execute returned -1 or
- * NdbSchemaCon::getNdbSchemaOp returned NULL), then this method
- * retrieves the error object containing information about
- * the error.
- *
- * @return Error object containing information about last error.
- */
- const NdbError & getNdbError() const;
+
+ const NdbError & getNdbError() const;
protected:
@@ -440,17 +540,48 @@ protected:
Ndb* theNdb; // Point back to the Ndb object.
NdbSchemaCon* theSchemaCon; // Point back to the connection object.
+
class NdbDictionary::Table * m_currentTable;
};
-inline
-const NdbError &
-NdbSchemaOp::getNdbError() const
-{
- return theSchemaCon->getNdbError();
-}
+/**
+ * Get old attribute type from new type
+ *
+ * NOTE! attrType is deprecated, use getType instead!
+ *
+ * @return Type of attribute: { Signed, UnSigned, Float,a String }
+ */
+inline
+AttrType
+convertColumnTypeToAttrType(NdbDictionary::Column::Type _type)
+{
+
+ switch(_type){
+ case NdbDictionary::Column::Bigint:
+ case NdbDictionary::Column::Int:
+ return Signed;
+ case NdbDictionary::Column::Bigunsigned:
+ case NdbDictionary::Column::Unsigned:
+ return UnSigned;
+ case NdbDictionary::Column::Float:
+ case NdbDictionary::Column::Decimal:
+ case NdbDictionary::Column::Double:
+ return Float;
+ case NdbDictionary::Column::Char:
+ case NdbDictionary::Column::Varchar:
+ case NdbDictionary::Column::Binary:
+ case NdbDictionary::Column::Varbinary:
+ return String;
+ case NdbDictionary::Column::Datetime:
+ case NdbDictionary::Column::Timespec:
+ case NdbDictionary::Column::Undefined:
+ default:
+ return NoAttrTypeDef;
+ }
+}
#endif
+
#endif
diff --git a/ndb/include/ndbapi/ndbapi_limits.h b/ndb/include/ndbapi/ndbapi_limits.h
index 428c5407cbd..1cf2d9b342d 100644
--- a/ndb/include/ndbapi/ndbapi_limits.h
+++ b/ndb/include/ndbapi/ndbapi_limits.h
@@ -18,29 +18,16 @@
#define NDBAPI_LIMITS_H
#define NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY 32
-#define NDB_MAX_TABLES 1600
+#define NDB_MAX_ATTRIBUTES_IN_INDEX NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
#define NDB_MAX_DATABASE_NAME_SIZE 128
#define NDB_MAX_SCHEMA_NAME_SIZE 128
#define NDB_MAX_TAB_NAME_SIZE 128
-#define NDB_MAX_ATTR_NAME_SIZE 32
-#define NDB_MAX_ATTR_DEFAULT_VALUE_SIZE 128
#define NDB_MAX_ATTRIBUTES_IN_TABLE 91
-#define NDB_MAX_ATTRIBUTES_IN_INDEX NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
+
#define NDB_MAX_TUPLE_SIZE_IN_WORDS 1023
-#define NDB_MAX_FIXED_KEY_LENGTH_IN_WORDS 8
#define NDB_MAX_KEYSIZE_IN_WORDS 1023
#define NDB_MAX_KEY_SIZE NDB_MAX_KEYSIZE_IN_WORDS*sizeof(Uint32)
-#define NDB_MAX_TUPLE_SIZE 8191
-#define NDB_MAX_TRANSACTIONS 1024
-#define NDB_MAX_PARALLEL_SCANS 12
+#define NDB_MAX_TUPLE_SIZE NDB_MAX_TUPLE_SIZE_IN_WORDS*sizeof(uint32)
#define NDB_MAX_ACTIVE_EVENTS 100
-#ifndef MIN
-#define MIN(x,y) (((x)<(y))?(x):(y))
-#endif
-
-#ifndef MAX
-#define MAX(x,y) (((x)>(y))?(x):(y))
-#endif
-
#endif
diff --git a/ndb/src/Makefile b/ndb/src/Makefile
index 4f71eb46056..72333aae890 100644
--- a/ndb/src/Makefile
+++ b/ndb/src/Makefile
@@ -10,7 +10,6 @@ DIRS := \
rep \
mgmclient \
cw \
- newtonapi \
ndbbaseclient
ifneq ($(NDB_ODBC),N)
DIRS += ndbclient
diff --git a/ndb/src/kernel/blocks/backup/restore/Restore.hpp b/ndb/src/kernel/blocks/backup/restore/Restore.hpp
index 0c075e18933..cf5ad56e1da 100644
--- a/ndb/src/kernel/blocks/backup/restore/Restore.hpp
+++ b/ndb/src/kernel/blocks/backup/restore/Restore.hpp
@@ -20,9 +20,7 @@
#include <ndb_global.h>
#include <BackupFormat.hpp>
#include <NdbApi.hpp>
-#include <AttrType.hpp>
-
-#include <NdbOut.hpp>
+#include <NdbSchemaCon.hpp>
#include "myVector.hpp"
#include <ndb_version.h>
diff --git a/ndb/src/kernel/blocks/backup/restore/main.cpp b/ndb/src/kernel/blocks/backup/restore/main.cpp
index 4c15785d5c2..ceb0c282e1d 100644
--- a/ndb/src/kernel/blocks/backup/restore/main.cpp
+++ b/ndb/src/kernel/blocks/backup/restore/main.cpp
@@ -23,6 +23,9 @@
#ifdef USE_MYSQL
#include <mysql.h>
#endif
+
+#include <NdbOut.hpp>
+
NdbOut& operator<<(NdbOut& ndbout, const TupleS& tuple);
NdbOut& operator<<(NdbOut& ndbout, const LogEntry& logEntry);
NdbOut& operator<<(NdbOut& ndbout, const RestoreMetaData &);
@@ -606,7 +609,7 @@ operator<<(NdbOut& ndbout, const AttributeS& attr){
break;
} // switch size
break;
- case (String):
+ case String:
if (desc.size == 8){
NdbDictionary::Column::Type type = desc.m_table->m_dictTable->getColumn(desc.attrId)->getType();
if(type == NdbDictionary::Column::Varchar){
@@ -622,7 +625,7 @@ operator<<(NdbOut& ndbout, const AttributeS& attr){
}
j = desc.arraySize;
break;
- case (Float):
+ case Float:
// Not yet supported to print float
ndbout << "float";
break;
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 7c2d94c6b7f..34ef9dbb08e 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -21,7 +21,6 @@
#include "MgmtErrorReporter.hpp"
#include <NdbOut.hpp>
-#include <AttrType.hpp>
#include <NdbApiSignal.hpp>
#include <kernel_types.h>
#include <RefConvert.hpp>
diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp
index 1b536b6d741..57967e5534f 100644
--- a/ndb/src/ndbapi/ClusterMgr.cpp
+++ b/ndb/src/ndbapi/ClusterMgr.cpp
@@ -21,7 +21,6 @@
#include "TransporterFacade.hpp"
#include "ClusterMgr.hpp"
#include <IPCConfig.hpp>
-#include "AttrType.hpp"
#include "NdbApiSignal.hpp"
#include "API.hpp"
#include <NdbSleep.h>
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index 448a29ca485..0304db67a39 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -26,8 +26,6 @@ Name: Ndb.cpp
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
-#include "NdbSchemaOp.hpp"
-#include "NdbSchemaCon.hpp"
#include <NdbOperation.hpp>
#include <NdbConnection.hpp>
#include <NdbEventOperation.hpp>
@@ -155,7 +153,7 @@ Ndb::NDB_connect(Uint32 tNode)
// Set connection pointer as NdbConnection object
//************************************************
tSignal->setData(theMyRef, 2); // Set my block reference
- tNdbCon->Status(Connecting); // Set status to connecting
+ tNdbCon->Status(NdbConnection::Connecting); // Set status to connecting
Uint32 nodeSequence;
{ // send and receive signal
tp->lock_mutex();
@@ -178,7 +176,7 @@ Ndb::NDB_connect(Uint32 tNode)
}//if
}
- if ((tReturnCode == 0) && (tNdbCon->Status() == Connected)) {
+ if ((tReturnCode == 0) && (tNdbCon->Status() == NdbConnection::Connected)) {
//************************************************
// Send and receive was successful
//************************************************
@@ -434,7 +432,7 @@ Ndb::startTransactionLocal(Uint32 aPriority, Uint32 nodeId)
theFirstTransId = tFirstTransId + 1;
}//if
#ifdef VM_TRACE
- if (tConnection->theListState != NotInList) {
+ if (tConnection->theListState != NdbConnection::NotInList) {
printState("startTransactionLocal %x", tConnection);
abort();
}
@@ -589,7 +587,7 @@ Ndb::NdbTamper(TamperType aAction, int aNode)
tSignal.setData (tAction, 1);
tSignal.setData(tNdbConn->ptr2int(),2);
tSignal.setData(theMyRef,3); // Set return block reference
- tNdbConn->Status(Connecting); // Set status to connecting
+ tNdbConn->Status(NdbConnection::Connecting); // Set status to connecting
TransporterFacade *tp = TransporterFacade::instance();
if (tAction == 3) {
tp->lock_mutex();
@@ -622,7 +620,7 @@ Ndb::NdbTamper(TamperType aAction, int aNode)
}//if
ret_code = sendRecSignal(tNode, WAIT_NDB_TAMPER, &tSignal, 0);
if (ret_code == 0) {
- if (tNdbConn->Status() != Connected) {
+ if (tNdbConn->Status() != NdbConnection::Connected) {
theRestartGCI = 0;
}//if
releaseNdbCon(tNdbConn);
@@ -637,6 +635,7 @@ Ndb::NdbTamper(TamperType aAction, int aNode)
return 0;
#endif
}
+#if 0
/****************************************************************************
NdbSchemaCon* startSchemaTransaction();
@@ -678,7 +677,7 @@ Ndb::closeSchemaTransaction(NdbSchemaCon* aSchemaCon)
theSchemaConToNdbList = NULL;
return;
}//Ndb::closeSchemaTransaction()
-
+#endif
/*****************************************************************************
void RestartGCI(int aRestartGCI);
diff --git a/ndb/src/ndbapi/NdbApiSignal.cpp b/ndb/src/ndbapi/NdbApiSignal.cpp
index a9cd5b1d53a..a44937cd398 100644
--- a/ndb/src/ndbapi/NdbApiSignal.cpp
+++ b/ndb/src/ndbapi/NdbApiSignal.cpp
@@ -29,7 +29,6 @@ Adjust: 971114 UABMNST First version.
******************************************************************************/
#include "API.hpp"
#include "NdbApiSignal.hpp"
-#include <AttrType.hpp>
/**
* The following include includes
diff --git a/ndb/src/ndbapi/NdbApiSignal.hpp b/ndb/src/ndbapi/NdbApiSignal.hpp
index 76cefe0e882..9d5bc0847be 100644
--- a/ndb/src/ndbapi/NdbApiSignal.hpp
+++ b/ndb/src/ndbapi/NdbApiSignal.hpp
@@ -31,7 +31,6 @@
#define NdbApiSignal_H
#include <kernel_types.h>
-#include "AttrType.hpp"
#include "TransporterFacade.hpp"
#include <TransporterDefinitions.hpp>
#include "Ndb.hpp"
diff --git a/ndb/src/ndbapi/NdbConnection.cpp b/ndb/src/ndbapi/NdbConnection.cpp
index 4ec098c3c60..fbfd0e99238 100644
--- a/ndb/src/ndbapi/NdbConnection.cpp
+++ b/ndb/src/ndbapi/NdbConnection.cpp
@@ -1706,7 +1706,7 @@ NdbConnection::getTransactionId()
return theTransactionId;
}//NdbConnection::getTransactionId()
-CommitStatusType
+NdbConnection::CommitStatusType
NdbConnection::commitStatus()
{
return theCommitStatus;
diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
index 02e3ee23f9c..1a7147c5b21 100644
--- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp
+++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp
@@ -17,7 +17,6 @@
#include "NdbDictionaryImpl.hpp"
#include "API.hpp"
#include <NdbOut.hpp>
-#include <AttrType.hpp>
#include "NdbApiSignal.hpp"
#include "TransporterFacade.hpp"
#include <signaldata/GetTabInfo.hpp>
@@ -1257,7 +1256,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
NdbTableImpl & impl,
bool alter)
{
- if((unsigned)impl.getNoOfPrimaryKeys() > MAXNROFTUPLEKEY){
+ if((unsigned)impl.getNoOfPrimaryKeys() > NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY){
m_error.code = 4317;
return -1;
}
diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp
index acc726e28c5..7b4afc72ef7 100644
--- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp
+++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp
@@ -21,7 +21,6 @@
#include "NdbDictionaryImpl.hpp"
#include "API.hpp"
#include <NdbOut.hpp>
-#include <AttrType.hpp>
#include "NdbApiSignal.hpp"
#include "TransporterFacade.hpp"
#include <signaldata/CreateEvnt.hpp>
@@ -489,52 +488,7 @@ NdbEventOperationImpl::getEventType()
}
}
-void
-NdbEventOperationImpl::printRecAttr(NdbRecAttr *p)
-{
- int size = p->attrSize();
- int aSize = p->arraySize();
- switch(p->attrType()){
- case UnSigned:
- switch(size) {
- case 8: ndbout << p->u_64_value(); break;
- case 4: ndbout << p->u_32_value(); break;
- case 2: ndbout << p->u_short_value(); break;
- case 1: ndbout << (unsigned) p->u_char_value(); break;
- default: ndbout << "Unknown size" << endl;
- }
- break;
-
- case Signed:
- switch(size) {
- case 8: ndbout << p->int64_value(); break;
- case 4: ndbout << p->int32_value(); break;
- case 2: ndbout << p->short_value(); break;
- case 1: ndbout << (int) p->char_value(); break;
- default: ndbout << "Unknown size" << endl;
- }
- break;
-
- case String:
- {
- char* buf = new char[aSize+1];
- memcpy(buf, p->aRef(), aSize);
- buf[aSize] = 0;
- ndbout << buf;
- delete [] buf;
- }
- break;
-
- case Float:
- ndbout << p->float_value();
- break;
-
- default:
- ndbout << "Unknown";
- break;
- }
-}
void
NdbEventOperationImpl::print()
@@ -1294,3 +1248,60 @@ NdbGlobalEventBuffer::real_wait(NdbGlobalEventBufferHandle *h,
n += hasData(h->m_bufferIds[i]);
return n;
}
+
+/**
+ * TODO Change this function to use the real datatypes
+ * from NdbDictionary alternatively make a
+ * "printer" in NdbRecAttr that can be used from all programs
+ */
+
+// and remove this include
+#include "NdbSchemaOp.hpp"
+void
+NdbEventOperationImpl::printRecAttr(NdbRecAttr *p)
+{
+ int size = p->attrSize();
+ int aSize = p->arraySize();
+
+
+ switch(convertColumnTypeToAttrType(p->getType())){
+ case UnSigned:
+ switch(size) {
+ case 8: ndbout << p->u_64_value(); break;
+ case 4: ndbout << p->u_32_value(); break;
+ case 2: ndbout << p->u_short_value(); break;
+ case 1: ndbout << (unsigned) p->u_char_value(); break;
+ default: ndbout << "Unknown size" << endl;
+ }
+ break;
+
+ case Signed:
+ switch(size) {
+ case 8: ndbout << p->int64_value(); break;
+ case 4: ndbout << p->int32_value(); break;
+ case 2: ndbout << p->short_value(); break;
+ case 1: ndbout << (int) p->char_value(); break;
+ default: ndbout << "Unknown size" << endl;
+ }
+ break;
+
+ case String:
+ {
+ char* buf = new char[aSize+1];
+ memcpy(buf, p->aRef(), aSize);
+ buf[aSize] = 0;
+ ndbout << buf;
+ delete [] buf;
+ }
+ break;
+
+ case Float:
+ ndbout << p->float_value();
+ break;
+
+ default:
+ ndbout << "Unknown";
+ break;
+ }
+
+}
diff --git a/ndb/src/ndbapi/NdbIndexOperation.cpp b/ndb/src/ndbapi/NdbIndexOperation.cpp
index ee5491d72a8..02d94f39f2d 100644
--- a/ndb/src/ndbapi/NdbIndexOperation.cpp
+++ b/ndb/src/ndbapi/NdbIndexOperation.cpp
@@ -87,7 +87,7 @@ NdbIndexOperation::indxInit(NdbIndexImpl * anIndex,
m_accessTable = anIndex->m_table;
m_theIndexLen = 0;
m_theNoOfIndexDefined = 0;
- for (Uint32 i=0; i<MAXNROFTUPLEKEY; i++)
+ for (Uint32 i=0; i<NDB_MAX_ATTRIBUTES_IN_INDEX; i++)
for (int j=0; j<3; j++)
m_theIndexDefined[i][j] = false;
@@ -221,7 +221,7 @@ int NdbIndexOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
goto equal_error2;
}//if
}//if
- } while (i < MAXNROFTUPLEKEY);
+ } while (i < NDB_MAX_ATTRIBUTES_IN_INDEX);
goto equal_error2;
} else {
goto equal_error1;
@@ -695,7 +695,7 @@ NdbIndexOperation::receiveTCINDXREF( NdbApiSignal* aSignal)
theStatus = Finished;
- theNdbCon->theReturnStatus = ReturnFailure;
+ theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
//--------------------------------------------------------------------------//
// If the transaction this operation belongs to consists only of simple reads
// we set the error code on the transaction object.
diff --git a/ndb/src/ndbapi/NdbOperation.cpp b/ndb/src/ndbapi/NdbOperation.cpp
index ccbfa767542..8bc9111d060 100644
--- a/ndb/src/ndbapi/NdbOperation.cpp
+++ b/ndb/src/ndbapi/NdbOperation.cpp
@@ -31,7 +31,7 @@
#include "NdbApiSignal.hpp"
#include "NdbRecAttr.hpp"
#include "NdbUtil.hpp"
-
+#include "ndbapi_limits.h"
#include <signaldata/TcKeyReq.hpp>
#include "NdbDictionaryImpl.hpp"
@@ -163,7 +163,7 @@ NdbOperation::init(NdbTableImpl* tab, NdbConnection* myConnection){
m_currentTable = m_accessTable = tab;
theNdbCon = myConnection;
- for (Uint32 i=0; i<MAXNROFTUPLEKEY; i++)
+ for (Uint32 i=0; i<NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY; i++)
for (int j=0; j<3; j++)
theTupleKeyDefined[i][j] = false;
diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp
index 18f8b79d12e..20134068075 100644
--- a/ndb/src/ndbapi/NdbOperationDefine.cpp
+++ b/ndb/src/ndbapi/NdbOperationDefine.cpp
@@ -31,7 +31,6 @@
#include "NdbConnection.hpp"
#include "Ndb.hpp"
#include "NdbRecAttr.hpp"
-#include "AttrType.hpp"
#include "NdbUtil.hpp"
#include "NdbOut.hpp"
#include "NdbImpl.hpp"
diff --git a/ndb/src/ndbapi/NdbOperationExec.cpp b/ndb/src/ndbapi/NdbOperationExec.cpp
index b2a6f99880c..d00c527550d 100644
--- a/ndb/src/ndbapi/NdbOperationExec.cpp
+++ b/ndb/src/ndbapi/NdbOperationExec.cpp
@@ -757,7 +757,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal)
theStatus = Finished;
- theNdbCon->theReturnStatus = ReturnFailure;
+ theNdbCon->theReturnStatus = NdbConnection::ReturnFailure;
//-------------------------------------------------------------------------//
// If the transaction this operation belongs to consists only of simple reads
// we set the error code on the transaction object.
diff --git a/ndb/src/ndbapi/NdbOperationInt.cpp b/ndb/src/ndbapi/NdbOperationInt.cpp
index be23a1c274c..e61fc5b05d7 100644
--- a/ndb/src/ndbapi/NdbOperationInt.cpp
+++ b/ndb/src/ndbapi/NdbOperationInt.cpp
@@ -31,7 +31,6 @@ Adjust: 991029 UABRONM First version.
#include "NdbConnection.hpp"
#include "Ndb.hpp"
#include "NdbRecAttr.hpp"
-#include "AttrType.hpp"
#include "NdbUtil.hpp"
#include "Interpreter.hpp"
@@ -69,7 +68,7 @@ NdbOperation::incCheck(const NdbColumnImpl* tNdbColumnImpl)
}
return tNdbColumnImpl->m_attrId;
} else {
- if (theNdbCon->theCommitStatus == Started)
+ if (theNdbCon->theCommitStatus == NdbConnection::Started)
setErrorCodeAbort(4200);
}
return -1;
@@ -121,7 +120,7 @@ NdbOperation::write_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
}
return tNdbColumnImpl->m_attrId;
} else {
- if (theNdbCon->theCommitStatus == Started)
+ if (theNdbCon->theCommitStatus == NdbConnection::Started)
setErrorCodeAbort(4200);
}
return -1;
@@ -169,7 +168,7 @@ NdbOperation::read_attrCheck(const NdbColumnImpl* tNdbColumnImpl)
}
return tNdbColumnImpl->m_attrId;
} else {
- if (theNdbCon->theCommitStatus == Started)
+ if (theNdbCon->theCommitStatus == NdbConnection::Started)
setErrorCodeAbort(4200);
}
return -1;
@@ -209,7 +208,7 @@ NdbOperation::initial_interpreterCheck()
}
return 0;
} else {
- if (theNdbCon->theCommitStatus == Started)
+ if (theNdbCon->theCommitStatus == NdbConnection::Started)
setErrorCodeAbort(4200);
}
return -1;
@@ -235,7 +234,7 @@ NdbOperation::labelCheck()
}
return 0;
} else {
- if (theNdbCon->theCommitStatus == Started)
+ if (theNdbCon->theCommitStatus == NdbConnection::Started)
setErrorCodeAbort(4200);
}
return -1;
@@ -255,7 +254,7 @@ NdbOperation::intermediate_interpreterCheck()
}
return 0;
} else {
- if (theNdbCon->theCommitStatus == Started)
+ if (theNdbCon->theCommitStatus == NdbConnection::Started)
setErrorCodeAbort(4200);
}
return -1;
diff --git a/ndb/src/ndbapi/NdbOperationScan.cpp b/ndb/src/ndbapi/NdbOperationScan.cpp
index df4f2421ec0..0c377d3fd98 100644
--- a/ndb/src/ndbapi/NdbOperationScan.cpp
+++ b/ndb/src/ndbapi/NdbOperationScan.cpp
@@ -31,7 +31,7 @@ NdbOperation::openScanRead(Uint32 aParallelism)
{
aParallelism = checkParallelism(aParallelism);
- if ((theNdbCon->theCommitStatus != Started) &&
+ if ((theNdbCon->theCommitStatus != NdbConnection::Started) &&
(theStatus != Init) &&
(aParallelism == 0)) {
setErrorCode(4200);
@@ -48,7 +48,7 @@ NdbOperation::openScanExclusive(Uint32 aParallelism)
{
aParallelism = checkParallelism(aParallelism);
- if ((theNdbCon->theCommitStatus != Started) &&
+ if ((theNdbCon->theCommitStatus != NdbConnection::Started) &&
(theStatus != Init) &&
(aParallelism == 0)) {
setErrorCode(4200);
@@ -65,7 +65,7 @@ NdbOperation::openScanReadHoldLock(Uint32 aParallelism)
{
aParallelism = checkParallelism(aParallelism);
- if ((theNdbCon->theCommitStatus != Started) &&
+ if ((theNdbCon->theCommitStatus != NdbConnection::Started) &&
(theStatus != Init) &&
(aParallelism == 0)) {
setErrorCode(4200);
@@ -82,7 +82,7 @@ NdbOperation::openScanReadCommitted(Uint32 aParallelism)
{
aParallelism = checkParallelism(aParallelism);
- if ((theNdbCon->theCommitStatus != Started) &&
+ if ((theNdbCon->theCommitStatus != NdbConnection::Started) &&
(theStatus != Init) &&
(aParallelism == 0)) {
setErrorCode(4200);
diff --git a/ndb/src/ndbapi/NdbOperationSearch.cpp b/ndb/src/ndbapi/NdbOperationSearch.cpp
index e1d5e823077..8b9b89dcf07 100644
--- a/ndb/src/ndbapi/NdbOperationSearch.cpp
+++ b/ndb/src/ndbapi/NdbOperationSearch.cpp
@@ -35,7 +35,6 @@ Adjust: 971022 UABMNST First version.
#include <Ndb.hpp>
#include "NdbImpl.hpp"
#include <NdbOut.hpp>
-#include "AttrType.hpp"
#include <AttributeHeader.hpp>
#include <signaldata/TcKeyReq.hpp>
@@ -102,7 +101,7 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
goto equal_error2;
}//if
}//if
- } while (i < MAXNROFTUPLEKEY);
+ } while (i < NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY);
goto equal_error2;
} else {
goto equal_error1;
diff --git a/ndb/src/ndbapi/NdbResultSet.cpp b/ndb/src/ndbapi/NdbResultSet.cpp
index 8397d5eef91..65ed43f60d8 100644
--- a/ndb/src/ndbapi/NdbResultSet.cpp
+++ b/ndb/src/ndbapi/NdbResultSet.cpp
@@ -61,7 +61,8 @@ NdbResultSet::updateTuple(){
}
NdbScanOperation * op = (NdbScanOperation*)(m_operation);
- return op->takeOverScanOp(UpdateRequest, op->m_transConnection);
+ return op->takeOverScanOp(NdbOperation::UpdateRequest,
+ op->m_transConnection);
}
NdbOperation*
@@ -71,7 +72,8 @@ NdbResultSet::updateTuple(NdbConnection* takeOverTrans){
return 0;
}
- return m_operation->takeOverScanOp(UpdateRequest, takeOverTrans);
+ return m_operation->takeOverScanOp(NdbOperation::UpdateRequest,
+ takeOverTrans);
}
int
@@ -82,7 +84,8 @@ NdbResultSet::deleteTuple(){
}
NdbScanOperation * op = (NdbScanOperation*)(m_operation);
- void * res = op->takeOverScanOp(DeleteRequest, op->m_transConnection);
+ void * res = op->takeOverScanOp(NdbOperation::DeleteRequest,
+ op->m_transConnection);
if(res == 0)
return -1;
return 0;
@@ -95,7 +98,8 @@ NdbResultSet::deleteTuple(NdbConnection * takeOverTrans){
return 0;
}
- void * res = m_operation->takeOverScanOp(DeleteRequest, takeOverTrans);
+ void * res = m_operation->takeOverScanOp(NdbOperation::DeleteRequest,
+ takeOverTrans);
if(res == 0)
return -1;
return 0;
diff --git a/ndb/src/ndbapi/NdbSchemaCon.cpp b/ndb/src/ndbapi/NdbSchemaCon.cpp
index fbf30c70d12..88e90f9957f 100644
--- a/ndb/src/ndbapi/NdbSchemaCon.cpp
+++ b/ndb/src/ndbapi/NdbSchemaCon.cpp
@@ -14,28 +14,31 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
/*********************************************************************
-Name: NdbSchemaCon.C
+Name: NdbSchemaCon.cpp
Include:
Link:
Author: UABMNST Mona Natterkvist UAB/B/SD
EMIKRON Mikael Ronstrom
Date: 020826
-Version: 2.0
-Description: Interface between application and NDB
+Version: 3.0
+Description: Old Interface between application and NDB
Documentation:
Adjust: 980126 UABMNST First version.
020826 EMIKRON New version adapted to new DICT version
-************************************************************************************************/
+ 040524 Magnus Svensson - Adapted to not be included in public NdbApi
+ unless the user wants to use it.
+
+ NOTE: This file is only used as a compatibility layer for old test programs,
+ New programs should use NdbDictionary.hpp
+*********************************************************************/
+
#include "NdbSchemaCon.hpp"
#include "NdbSchemaOp.hpp"
#include "NdbApiSignal.hpp"
-#include "TransporterFacade.hpp"
-#include <RefConvert.hpp>
-#include <signaldata/CreateIndx.hpp>
-#include <signaldata/DropIndx.hpp>
-#include <signaldata/CreateTable.hpp>
-#include <NdbOut.hpp>
+
/*********************************************************************
NdbSchemaCon(Ndb* aNdb);
diff --git a/ndb/src/ndbapi/NdbSchemaOp.cpp b/ndb/src/ndbapi/NdbSchemaOp.cpp
index 9e495229661..aa2d0be311f 100644
--- a/ndb/src/ndbapi/NdbSchemaOp.cpp
+++ b/ndb/src/ndbapi/NdbSchemaOp.cpp
@@ -16,24 +16,31 @@
/*****************************************************************************
-Name: NdbSchemaOp.C
+Name: NdbSchemaOp.cpp
Include:
Link:
Author: UABMNST Mona Natterkvist UAB/B/SD
EMIKRON Mikael Ronstrom
-Date: 020826
-Version: 2.0
+Date: 040524
+Version: 3.0
Description: Interface between application and NDB
Documentation: Handles createTable and createAttribute calls
Adjust: 980125 UABMNST First version.
020826 EMIKRON New version for new DICT
+ 040524 Magnus Svensson - Adapted to not be included in public NdbApi
+ unless the user wants to use it.
+
+ NOTE: This file is only used as a compatibility layer for old test programs,
+ New programs should use NdbDictionary.hpp
*****************************************************************************/
#include <assert.h>
#include "NdbSchemaOp.hpp"
#include "NdbSchemaCon.hpp"
#include "API.hpp"
+
+
/*****************************************************************************
NdbSchemaOp(Ndb* aNdb, Table* aTable);
@@ -203,3 +210,11 @@ NdbSchemaOp::init(NdbSchemaCon* aSchemaCon)
theSchemaCon = aSchemaCon;
return 0;
}//NdbSchemaOp::init()
+
+
+const NdbError &
+NdbSchemaOp::getNdbError() const
+{
+ return theSchemaCon->getNdbError();
+}
+
diff --git a/ndb/src/ndbapi/NdbUtil.hpp b/ndb/src/ndbapi/NdbUtil.hpp
index 6a82af85987..80fc15ddd8c 100644
--- a/ndb/src/ndbapi/NdbUtil.hpp
+++ b/ndb/src/ndbapi/NdbUtil.hpp
@@ -30,7 +30,6 @@ Comment:
#define NdbUtil_H
#include <ndb_global.h>
-#include "AttrType.hpp"
class NdbApiSignal;
class NdbOperation;
diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp
index 696dfe68e40..2d722e12129 100644
--- a/ndb/src/ndbapi/Ndbif.cpp
+++ b/ndb/src/ndbapi/Ndbif.cpp
@@ -16,10 +16,9 @@
#include "NdbApiSignal.hpp"
-#include "AttrType.hpp"
#include "NdbImpl.hpp"
-#include "NdbSchemaOp.hpp"
-#include "NdbSchemaCon.hpp"
+//#include "NdbSchemaOp.hpp"
+//#include "NdbSchemaCon.hpp"
#include "NdbOperation.hpp"
#include "NdbIndexOperation.hpp"
#include "NdbScanReceiver.hpp"
@@ -42,13 +41,12 @@
/******************************************************************************
- * int init( int aNrOfCon, int aNrOfOp );
+ * int init( int aMaxNoOfTransactions );
*
* Return Value: Return 0 : init was successful.
* Return -1: In all other case.
- * Parameters: aNrOfCon : Number of connections offered to the application.
- * aNrOfOp : Number of operations offered to the application.
- * Remark: Create pointers and idle list Synchronous.
+ * Parameters: aMaxNoOfTransactions : Max number of simultaneous transations
+ * Remark: Create pointers and idle list Synchronous.
****************************************************************************/
int
Ndb::init(int aMaxNoOfTransactions)
@@ -254,8 +252,9 @@ Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId)
for (int i = tNoSentTransactions - 1; i >= 0; i--) {
NdbConnection* localCon = theSentTransactionsArray[i];
if (localCon->getConnectedNodeId() == aNodeId ) {
- const SendStatusType sendStatus = localCon->theSendStatus;
- if (sendStatus == sendTC_OP || sendStatus == sendTC_COMMIT) {
+ const NdbConnection::SendStatusType sendStatus = localCon->theSendStatus;
+ if (sendStatus == NdbConnection::sendTC_OP ||
+ sendStatus == NdbConnection::sendTC_COMMIT) {
/*
A transaction was interrupted in the prepare phase by a node
failure. Since the transaction was not found in the phase
@@ -263,13 +262,13 @@ Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId)
we report a normal node failure abort.
*/
localCon->setOperationErrorCodeAbort(4010);
- localCon->theCompletionStatus = CompletedFailure;
- } else if (sendStatus == sendTC_ROLLBACK) {
+ localCon->theCompletionStatus = NdbConnection::CompletedFailure;
+ } else if (sendStatus == NdbConnection::sendTC_ROLLBACK) {
/*
We aimed for abort and abort we got even if it was by a node
failure. We will thus report it as a success.
*/
- localCon->theCompletionStatus = CompletedSuccess;
+ localCon->theCompletionStatus = NdbConnection::CompletedSuccess;
} else {
#ifdef VM_TRACE
printState("abortTransactionsAfterNodeFailure %x", this);
@@ -281,7 +280,7 @@ Ndb::abortTransactionsAfterNodeFailure(Uint16 aNodeId)
intact since the node was failing and they were aborted. Thus we
set commit state to Aborted and set state to release on close.
*/
- localCon->theCommitStatus = Aborted;
+ localCon->theCommitStatus = NdbConnection::Aborted;
localCon->theReleaseOnClose = true;
completedTransaction(localCon);
}//if
@@ -328,7 +327,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
- (tCon->theSendStatus == sendTC_OP)) {
+ (tCon->theSendStatus == NdbConnection::sendTC_OP)) {
tReturnCode = tCon->receiveTCKEYCONF(keyConf, aSignal->getLength());
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -356,7 +355,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber() == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
- if (tCon->theSendStatus == sendTC_OP) {
+ if (tCon->theSendStatus == NdbConnection::sendTC_OP) {
tReturnCode = tOp->receiveREAD_CONF(tDataPtr,
aSignal->getLength());
if (tReturnCode != -1) {
@@ -381,7 +380,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber() == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
- if (tCon->theSendStatus == sendTC_OP) {
+ if (tCon->theSendStatus == NdbConnection::sendTC_OP) {
tReturnCode = tOp->receiveTRANSID_AI(tDataPtr,
aSignal->getLength());
if (tReturnCode != -1) {
@@ -398,7 +397,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber() == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
- if (tCon->theSendStatus == sendTC_OP) {
+ if (tCon->theSendStatus == NdbConnection::sendTC_OP) {
tReturnCode = tOp->receiveTRANSID_AI(tDataPtr,
aSignal->getLength());
if (tReturnCode != -1) {
@@ -442,8 +441,8 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber() == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
- if ((tCon->theSendStatus == sendTC_OP) ||
- (tCon->theSendStatus == sendTC_COMMIT)) {
+ if ((tCon->theSendStatus == NdbConnection::sendTC_OP) ||
+ (tCon->theSendStatus == NdbConnection::sendTC_COMMIT)) {
tReturnCode = tCon->receiveTCKEY_FAILCONF(failConf);
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -469,8 +468,8 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber() == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
- if ((tCon->theSendStatus == sendTC_OP) ||
- (tCon->theSendStatus == sendTC_ROLLBACK)) {
+ if ((tCon->theSendStatus == NdbConnection::sendTC_OP) ||
+ (tCon->theSendStatus == NdbConnection::sendTC_ROLLBACK)) {
tReturnCode = tCon->receiveTCKEY_FAILREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -490,7 +489,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tOp->checkMagicNumber() == 0) {
tCon = tOp->theNdbCon;
if (tCon != NULL) {
- if (tCon->theSendStatus == sendTC_OP) {
+ if (tCon->theSendStatus == NdbConnection::sendTC_OP) {
tReturnCode = tOp->receiveTCKEYREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -512,7 +511,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
- (tCon->theSendStatus == sendTC_COMMIT)) {
+ (tCon->theSendStatus == NdbConnection::sendTC_COMMIT)) {
tReturnCode = tCon->receiveTC_COMMITCONF(commitConf);
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -537,7 +536,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
- (tCon->theSendStatus == sendTC_COMMIT)) {
+ (tCon->theSendStatus == NdbConnection::sendTC_COMMIT)) {
tReturnCode = tCon->receiveTC_COMMITREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -553,7 +552,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
- (tCon->theSendStatus == sendTC_ROLLBACK)) {
+ (tCon->theSendStatus == NdbConnection::sendTC_ROLLBACK)) {
tReturnCode = tCon->receiveTCROLLBACKCONF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -568,7 +567,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
- (tCon->theSendStatus == sendTC_ROLLBACK)) {
+ (tCon->theSendStatus == NdbConnection::sendTC_ROLLBACK)) {
tReturnCode = tCon->receiveTCROLLBACKREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -789,7 +788,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
const BlockReference aTCRef = aSignal->theSendersBlockRef;
tCon = void2con(tFirstDataPtr);
if ((tCon->checkMagicNumber() == 0) &&
- (tCon->theSendStatus == sendTC_OP)) {
+ (tCon->theSendStatus == NdbConnection::sendTC_OP)) {
tReturnCode = tCon->receiveTCINDXCONF(indxConf, aSignal->getLength());
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -812,7 +811,7 @@ Ndb::handleReceivedSignal(NdbApiSignal* aSignal, LinearSectionPtr ptr[3])
if (tIndexOp->checkMagicNumber() == 0) {
tCon = tIndexOp->theNdbCon;
if (tCon != NULL) {
- if (tCon->theSendStatus == sendTC_OP) {
+ if (tCon->theSendStatus == NdbConnection::sendTC_OP) {
tReturnCode = tIndexOp->receiveTCINDXREF(aSignal);
if (tReturnCode != -1) {
completedTransaction(tCon);
@@ -866,7 +865,8 @@ Ndb::completedTransaction(NdbConnection* aCon)
Uint32 tTransArrayIndex = aCon->theTransArrayIndex;
Uint32 tNoSentTransactions = theNoOfSentTransactions;
Uint32 tNoCompletedTransactions = theNoOfCompletedTransactions;
- if ((tNoSentTransactions > 0) && (aCon->theListState == InSendList) &&
+ if ((tNoSentTransactions > 0) &&
+ (aCon->theListState == NdbConnection::InSendList) &&
(tTransArrayIndex < tNoSentTransactions)) {
NdbConnection* tMoveCon = theSentTransactionsArray[tNoSentTransactions - 1];
@@ -880,7 +880,7 @@ Ndb::completedTransaction(NdbConnection* aCon)
theNoOfCompletedTransactions = tNoCompletedTransactions + 1;
theNoOfSentTransactions = tNoSentTransactions - 1;
- aCon->theListState = InCompletedList;
+ aCon->theListState = NdbConnection::InCompletedList;
aCon->handleExecuteCompletion();
if ((theMinNoOfEventsToWakeUp != 0) &&
(theNoOfCompletedTransactions >= theMinNoOfEventsToWakeUp)) {
@@ -915,7 +915,7 @@ Ndb::reportCallback(NdbConnection** aCopyArray, Uint32 aNoOfCompletedTrans)
NdbAsynchCallback aCallback = aCopyArray[i]->theCallbackFunction;
int tResult = 0;
if (aCallback != NULL) {
- if (aCopyArray[i]->theReturnStatus == ReturnFailure) {
+ if (aCopyArray[i]->theReturnStatus == NdbConnection::ReturnFailure) {
tResult = -1;
}//if
(*aCallback)(tResult, aCopyArray[i], anyObject);
@@ -939,13 +939,13 @@ Ndb::pollCompleted(NdbConnection** aCopyArray)
if (tNoCompletedTransactions > 0) {
for (i = 0; i < tNoCompletedTransactions; i++) {
aCopyArray[i] = theCompletedTransactionsArray[i];
- if (aCopyArray[i]->theListState != InCompletedList) {
+ if (aCopyArray[i]->theListState != NdbConnection::InCompletedList) {
ndbout << "pollCompleted error ";
ndbout << aCopyArray[i]->theListState << endl;
abort();
}//if
theCompletedTransactionsArray[i] = NULL;
- aCopyArray[i]->theListState = NotInList;
+ aCopyArray[i]->theListState = NdbConnection::NotInList;
}//for
}//if
theNoOfCompletedTransactions = 0;
@@ -967,8 +967,8 @@ Ndb::check_send_timeout()
a_con->printState();
#endif
a_con->setOperationErrorCodeAbort(4012);
- a_con->theCommitStatus = Aborted;
- a_con->theCompletionStatus = CompletedFailure;
+ a_con->theCommitStatus = NdbConnection::Aborted;
+ a_con->theCompletionStatus = NdbConnection::CompletedFailure;
a_con->handleExecuteCompletion();
remove_sent_list(i);
insert_completed_list(a_con);
@@ -997,7 +997,7 @@ Ndb::insert_completed_list(NdbConnection* a_con)
Uint32 no_of_comp = theNoOfCompletedTransactions;
theCompletedTransactionsArray[no_of_comp] = a_con;
theNoOfCompletedTransactions = no_of_comp + 1;
- a_con->theListState = InCompletedList;
+ a_con->theListState = NdbConnection::InCompletedList;
a_con->theTransArrayIndex = no_of_comp;
return no_of_comp;
}
@@ -1008,7 +1008,7 @@ Ndb::insert_sent_list(NdbConnection* a_con)
Uint32 no_of_sent = theNoOfSentTransactions;
theSentTransactionsArray[no_of_sent] = a_con;
theNoOfSentTransactions = no_of_sent + 1;
- a_con->theListState = InSendList;
+ a_con->theListState = NdbConnection::InSendList;
a_con->theTransArrayIndex = no_of_sent;
return no_of_sent;
}
@@ -1046,10 +1046,10 @@ Ndb::sendPrepTrans(int forceSend)
if ((tp->getNodeSequence(node_id) == a_con->theNodeSequence) &&
tp->get_node_alive(node_id) ||
(tp->get_node_stopping(node_id) &&
- ((a_con->theSendStatus == sendABORT) ||
- (a_con->theSendStatus == sendABORTfail) ||
- (a_con->theSendStatus == sendCOMMITstate) ||
- (a_con->theSendStatus == sendCompleted)))) {
+ ((a_con->theSendStatus == NdbConnection::sendABORT) ||
+ (a_con->theSendStatus == NdbConnection::sendABORTfail) ||
+ (a_con->theSendStatus == NdbConnection::sendCOMMITstate) ||
+ (a_con->theSendStatus == NdbConnection::sendCompleted)))) {
/*
We will send if
1) Node is alive and sequences are correct OR
@@ -1081,13 +1081,13 @@ Ndb::sendPrepTrans(int forceSend)
again and will thus set the state to Aborted to avoid a more or
less eternal loop of tries.
*/
- if (a_con->theSendStatus == sendOperations) {
+ if (a_con->theSendStatus == NdbConnection::sendOperations) {
a_con->setOperationErrorCodeAbort(4021);
- a_con->theCommitStatus = NeedAbort;
+ a_con->theCommitStatus = NdbConnection::NeedAbort;
TRACE_DEBUG("Send buffer full and sendOperations");
} else {
a_con->setOperationErrorCodeAbort(4026);
- a_con->theCommitStatus = Aborted;
+ a_con->theCommitStatus = NdbConnection::Aborted;
TRACE_DEBUG("Send buffer full, set state to Aborted");
}//if
}//if
@@ -1104,7 +1104,7 @@ Ndb::sendPrepTrans(int forceSend)
*/
TRACE_DEBUG("Abort a transaction when stopping a node");
a_con->setOperationErrorCodeAbort(4023);
- a_con->theCommitStatus = NeedAbort;
+ a_con->theCommitStatus = NdbConnection::NeedAbort;
} else {
/*
The node is hard dead and we cannot continue. We will also release
@@ -1114,10 +1114,10 @@ Ndb::sendPrepTrans(int forceSend)
a_con->setOperationErrorCodeAbort(4025);
a_con->theReleaseOnClose = true;
a_con->theTransactionIsStarted = false;
- a_con->theCommitStatus = Aborted;
+ a_con->theCommitStatus = NdbConnection::Aborted;
}//if
}//if
- a_con->theCompletionStatus = CompletedFailure;
+ a_con->theCompletionStatus = NdbConnection::CompletedFailure;
a_con->handleExecuteCompletion();
insert_completed_list(a_con);
}//for
diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp
index be7acc48d7a..042faa431a0 100644
--- a/ndb/src/ndbapi/Ndbinit.cpp
+++ b/ndb/src/ndbapi/Ndbinit.cpp
@@ -17,8 +17,8 @@
#include "NdbApiSignal.hpp"
#include "NdbImpl.hpp"
-#include "NdbSchemaOp.hpp"
-#include "NdbSchemaCon.hpp"
+//#include "NdbSchemaOp.hpp"
+//#include "NdbSchemaCon.hpp"
#include "NdbOperation.hpp"
#include "NdbConnection.hpp"
#include "NdbRecAttr.hpp"
@@ -72,8 +72,8 @@ Ndb::Ndb( const char* aDataBase , const char* aDataBaseSchema) :
theOpIdleList(NULL),
theScanOpIdleList(NULL),
theIndexOpIdleList(NULL),
- theSchemaConIdleList(NULL),
- theSchemaConToNdbList(NULL),
+// theSchemaConIdleList(NULL),
+// theSchemaConToNdbList(NULL),
theTransactionList(NULL),
theConnectionArray(NULL),
theRecAttrIdleList(NULL),
@@ -207,8 +207,8 @@ Ndb::~Ndb()
NdbMutex_Unlock(&createNdbMutex);
- if (theSchemaConToNdbList != NULL)
- closeSchemaTransaction(theSchemaConToNdbList);
+// if (theSchemaConToNdbList != NULL)
+// closeSchemaTransaction(theSchemaConToNdbList);
while ( theConIdleList != NULL )
freeNdbCon();
while ( theSignalIdleList != NULL )
diff --git a/ndb/src/ndbapi/Ndblist.cpp b/ndb/src/ndbapi/Ndblist.cpp
index 3839cc3291b..0d9c0f60985 100644
--- a/ndb/src/ndbapi/Ndblist.cpp
+++ b/ndb/src/ndbapi/Ndblist.cpp
@@ -16,8 +16,8 @@
#include <NdbOut.hpp>
#include "Ndb.hpp"
-#include "NdbSchemaOp.hpp"
-#include "NdbSchemaCon.hpp"
+//#include "NdbSchemaOp.hpp"
+//#include "NdbSchemaCon.hpp"
#include "NdbOperation.hpp"
#include "NdbScanOperation.hpp"
#include "NdbIndexOperation.hpp"
@@ -104,7 +104,7 @@ Ndb::createConIdleList(int aNrOfCon)
tNdbCon->next(theConIdleList);
theConIdleList = tNdbCon;
}
- tNdbCon->Status(NotConnected);
+ tNdbCon->Status(NdbConnection::NotConnected);
}
theNoOfAllocatedTransactions = aNrOfCon;
return aNrOfCon;
@@ -770,7 +770,7 @@ Ndb::releaseConnectToNdb(NdbConnection* a_con)
tSignal.setData((tConPtr = a_con->getTC_ConnectPtr()), 1);
tSignal.setData(theMyRef, 2);
tSignal.setData(a_con->ptr2int(), 3);
- a_con->Status(DisConnecting);
+ a_con->Status(NdbConnection::DisConnecting);
a_con->theMagicNumber = 0x37412619;
int ret_code = sendRecSignal(node_id,
WAIT_TC_RELEASE,
diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp
index f4a3ae3e87d..7806e482f1f 100644
--- a/ndb/src/ndbapi/TransporterFacade.cpp
+++ b/ndb/src/ndbapi/TransporterFacade.cpp
@@ -16,7 +16,6 @@
#include <ndb_global.h>
#include <ndb_limits.h>
-#include <AttrType.hpp>
#include "TransporterFacade.hpp"
#include "ClusterMgr.hpp"
#include <IPCConfig.hpp>
diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp
index d9d2dbbcf0f..1fe72debe1c 100644
--- a/ndb/src/ndbapi/TransporterFacade.hpp
+++ b/ndb/src/ndbapi/TransporterFacade.hpp
@@ -17,7 +17,6 @@
#ifndef TransporterFacade_H
#define TransporterFacade_H
-#include <AttrType.hpp>
#include <kernel_types.h>
#include <ndb_limits.h>
#include <NdbThread.h>
@@ -43,6 +42,10 @@ extern "C" {
void atexit_stop_instance();
}
+/**
+ * Max number of Ndb objects in different threads.
+ * (Ndb objects should not be shared by different threads.)
+ */
class TransporterFacade
{
public:
@@ -156,6 +159,8 @@ private:
/**
* Block number handling
*/
+ static const unsigned MAX_NO_THREADS = 4711;
+
struct ThreadData {
static const Uint32 ACTIVE = (1 << 16) | 1;
static const Uint32 INACTIVE = (1 << 16);
diff --git a/ndb/test/include/NDBT_Table.hpp b/ndb/test/include/NDBT_Table.hpp
index 950c1f15ff7..eee76773106 100644
--- a/ndb/test/include/NDBT_Table.hpp
+++ b/ndb/test/include/NDBT_Table.hpp
@@ -25,66 +25,6 @@
class NDBT_Attribute : public NdbDictionary::Column {
friend class NdbOut& operator <<(class NdbOut&, const NDBT_Attribute &);
public:
- NDBT_Attribute(const char* anAttrName,
- AttrType type,
- int sz = 4,
- KeyType key = NoKey,
- bool nullable = false,
- StorageAttributeType indexOnly = NormalStorageAttribute,
- StorageMode _sm = MMBased) :
- NdbDictionary::Column(anAttrName)
- {
- assert(anAttrName != 0);
-
- setNullable(nullable);
- setIndexOnlyStorage(indexOnly == IndexStorageAttribute);
- setPrimaryKey(key != NoKey);
- setTupleKey(key == TupleId);
- setLength(1);
- switch(type){
- case ::Signed:
- if(sz == 8)
- setType(NdbDictionary::Column::Bigint);
- else if (sz == 4)
- setType(NdbDictionary::Column::Int);
- else {
- setType(NdbDictionary::Column::Int);
- setLength(sz);
- }
- break;
-
- case ::UnSigned:
- if(sz == 8)
- setType(NdbDictionary::Column::Bigunsigned);
- else if (sz == 4)
- setType(NdbDictionary::Column::Unsigned);
- else {
- setType(NdbDictionary::Column::Unsigned);
- setLength(sz);
- }
- break;
-
- case ::Float:
- if(sz == 8)
- setType(NdbDictionary::Column::Double);
- else if (sz == 4)
- setType(NdbDictionary::Column::Float);
- else{
- setType(NdbDictionary::Column::Float);
- setLength(sz);
- }
- break;
-
- case ::String:
- setType(NdbDictionary::Column::Char);
- setLength(sz);
- break;
-
- case ::NoAttrTypeDef:
- break;
- }
- }
-
NDBT_Attribute(const char* _name,
Column::Type _type,
int _length = 1,
@@ -132,4 +72,13 @@ NDBT_Table::discoverTableFromDb(Ndb* ndb, const char * name){
return ndb->getDictionary()->getTable(name);
}
+
+/**
+ * Print meta information about index
+ * (information on how it is strored, what the attributes look like etc.)
+ */
+class NdbOut& operator <<(class NdbOut&, const NdbDictionary::Index &);
+
+
+
#endif
diff --git a/ndb/test/ndbapi/acid/acid.cpp b/ndb/test/ndbapi/acid/acid.cpp
index 49961531a1c..157b3c7b3ef 100644
--- a/ndb/test/ndbapi/acid/acid.cpp
+++ b/ndb/test/ndbapi/acid/acid.cpp
@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <NdbApi.hpp>
+#include <NdbSchemaCon.hpp>
#include <NdbMutex.h>
#include <NdbOut.hpp>
#include <NdbSleep.h>
@@ -230,7 +231,6 @@ extern "C" void* NdbThreadFuncInsert(void* pArg)
VerifyMethodInt(pNdbOperationW, setValue(c_szWarehouseSum, nWarehouseSum));
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
- CommitStatusType cs = pNdbConnection->commitStatus();
if(iExec<0 && iError!=0 && iError!=266 && iError!=630) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
@@ -285,7 +285,6 @@ extern "C" void* NdbThreadFuncUpdate(void* pArg)
VerifyMethodInt(pNdbOperationW, setValue(c_szWarehouseSum, nWarehouseSum));
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
- CommitStatusType cs = pNdbConnection->commitStatus();
if(iExec<0 && iError!=0 && iError!=266 && iError!=626) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
@@ -333,7 +332,6 @@ extern "C" void* NdbThreadFuncDelete(void* pArg)
}
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
- CommitStatusType cs = pNdbConnection->commitStatus();
if(iExec<0 && iError!=0 && iError!=266 && iError!=626) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
@@ -389,7 +387,7 @@ extern "C" void* NdbThreadFuncRead(void* pArg)
}
int iExec = pNdbConnection->execute(Commit);
int iError = pNdbConnection->getNdbError().code;
- CommitStatusType cs = pNdbConnection->commitStatus();
+
if(iExec<0 && iError!=0 && iError!=266 && iError!=626) {
ReportMethodInt(iExec, pNdbConnection, "pNdbConnection", "execute(Commit)", __FILE__, __LINE__);
}
@@ -465,8 +463,7 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
VerifyMethodInt(pNdb, init());
VerifyMethodInt(pNdb, waitUntilReady());
- NdbSchemaCon* pNdbSchemaCon = NULL ;
- VerifyMethodPtr(pNdbSchemaCon, pNdb, startSchemaTransaction());
+ NdbSchemaCon* pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb);
if(!pNdbSchemaCon){
ndbout <<"startSchemaTransaction failed, exiting now" << endl ;
delete pNdb ;
@@ -497,9 +494,9 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseSum, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szWarehouseCount, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaCon, execute());
- VerifyMethodVoid(pNdb, closeSchemaTransaction(pNdbSchemaCon));
+ NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon);
- VerifyMethodPtr(pNdbSchemaCon, pNdb, startSchemaTransaction());
+ pNdbSchemaCon= NdbSchemaCon::startSchemaTrans(pNdb);
VerifyMethodPtr(pNdbSchemaOp, pNdbSchemaCon, getNdbSchemaOp());
#if defined NDB_OSE || defined NDB_SOFTOSE
VerifyMethodInt(pNdbSchemaOp, createTable(
@@ -526,7 +523,7 @@ NDB_COMMAND(acid, "acid", "acid", "acid", 65535)
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictSum, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaOp, createAttribute(c_szDistrictCount, NoKey, 32, 1, UnSigned, MMBased, false));
VerifyMethodInt(pNdbSchemaCon, execute());
- VerifyMethodVoid(pNdb, closeSchemaTransaction(pNdbSchemaCon));
+ NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon);
g_pNdbMutex = NdbMutex_Create();
NdbMutex_Lock(g_pNdbMutex);
diff --git a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp
index 0822f3ee999..396ac06c87a 100644
--- a/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp
+++ b/ndb/test/ndbapi/flexAsynch/flexAsynch.cpp
@@ -15,7 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
#include "NdbApi.hpp"
+#include <NdbSchemaCon.hpp>
#include <NdbMain.h>
#include <md5_hash.hpp>
@@ -738,7 +740,7 @@ createTables(Ndb* pMyNdb){
if (theTableCreateFlag == 0) {
for(int i=0; i < 1 ;i++) {
ndbout << "Creating " << tableName[i] << "..." << endl;
- MySchemaTransaction = pMyNdb->startSchemaTransaction();
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb);
if(MySchemaTransaction == NULL &&
(!error_handler(MySchemaTransaction->getNdbError())))
@@ -748,7 +750,8 @@ createTables(Ndb* pMyNdb){
if(MySchemaOp == NULL &&
(!error_handler(MySchemaTransaction->getNdbError())))
return -1;
-
+
+
check = MySchemaOp->createTable( tableName[i]
,8 // Table Size
,TupleKey // Key Type
@@ -793,7 +796,7 @@ createTables(Ndb* pMyNdb){
(!error_handler(MySchemaTransaction->getNdbError())))
return -1;
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
}
}
diff --git a/ndb/test/ndbapi/flexScan/flexScan.cpp b/ndb/test/ndbapi/flexScan/flexScan.cpp
index 19fb6dc5ab0..5b5b4dde730 100644
--- a/ndb/test/ndbapi/flexScan/flexScan.cpp
+++ b/ndb/test/ndbapi/flexScan/flexScan.cpp
@@ -62,6 +62,7 @@
#include <NdbMain.h>
#include <NdbTest.hpp>
#include <NDBT_Error.hpp>
+#include <NdbSchemaCon.hpp>
#define PKSIZE 1
#define FOREVER 1
@@ -151,7 +152,6 @@ static void UpdateArray(int *attrValue)
int attrCount = 0;
int opCount = 0;
int sizeCount = 0;
- int Index = 0;
int* pValue = attrValue;
for (tableCount = 0; tableCount < tNoOfTables; tableCount++) {
@@ -179,7 +179,6 @@ static void Compare(int* attrValue, int* readValue)
int attrCount = 0;
int OpCount = 0;
int first = 0;
- int sizeCount = 0;
for (tableCount = 0; tableCount < tNoOfTables; tableCount++) {
for (attrCount = 0; attrCount < tNoOfAttributes-1; attrCount++) {
@@ -592,19 +591,14 @@ flexScanThread(void* ThreadData)
ThreadNdb* pThreadData = (ThreadNdb*)ThreadData;
unsigned int thread_no = pThreadData->ThreadNo;
unsigned int thread_base = (thread_no * 2000000) + (tNodeId * 26000);
- int NrOfScannedRecords = 0;
int tThreadResult = 0;
Ndb* MyNdb = NULL;
- NdbConnection *MyTransaction = NULL;
- NdbOperation* MyOperation[MAXTABLES];
int check = 0;
StartType tType = stLast;
int* pkValue = NULL;
int* attrValue = NULL;
int* readValue = NULL;
int AllocSize = 0;
- NdbRecAttr* tTmp = NULL;
- OperationType opType;
AllocSize = tNoOfTables * (tNoOfAttributes-1) * tNoOfOperations *
tAttributeSize * sizeof(int);
@@ -770,15 +764,15 @@ static int createTables(Ndb* pMyNdb)
do {
i++;
ndbout << endl << "Creating " << tableName[i - 1] << "..." << endl;
-
- MySchemaTransaction = pMyNdb->startSchemaTransaction();
+
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb);
if( MySchemaTransaction == NULL ) {
return (-1);
} // if
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL ) {
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return (-1);
} // if
@@ -800,14 +794,14 @@ static int createTables(Ndb* pMyNdb)
,40); // Nr of Pages
#endif
if (check == -1) {
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return -1;
} // if
check = MySchemaOp->createAttribute( (char*)attrName[0], TupleKey, 32, PKSIZE,
UnSigned, MMBased, NotNullAttribute );
if (check == -1) {
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return -1;
} // if
@@ -815,7 +809,7 @@ static int createTables(Ndb* pMyNdb)
check = MySchemaOp->createAttribute( (char*)attrName[j], NoKey, 32, tAttributeSize,
UnSigned, MMBased, NotNullAttribute );
if (check == -1) {
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return -1;
} // if
} // for
@@ -825,7 +819,7 @@ static int createTables(Ndb* pMyNdb)
ndbout << "Probably, " << tableName[i - 1] << " already exist" << endl;
} // if
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
} while (tNoOfTables > i);
}
@@ -1058,7 +1052,6 @@ static int insertRows(Ndb* pNdb, // NDB object
int attrCount = 0;
NdbConnection* MyTransaction = NULL;
NdbOperation* MyOperations[MAXTABLES] = {NULL};
- int Index = 0;
int opCount = 0;
for (opCount = 0; opCount < tNoOfOperations; opCount++) {
@@ -1099,7 +1092,7 @@ static int insertRows(Ndb* pNdb, // NDB object
} // if
for (attrCount = 0; attrCount < tNoOfAttributes - 1; attrCount++) {
- Index = tableCount * (tNoOfAttributes - 1) * tNoOfOperations * tAttributeSize +
+ int Index = tableCount * (tNoOfAttributes - 1) * tNoOfOperations * tAttributeSize +
attrCount * tNoOfOperations * tAttributeSize + opCount * tAttributeSize;
check = MyOperations[tableCount]->
setValue((char*)attrName[attrCount + 1],
diff --git a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp b/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp
index a2352edf707..47960cd5d12 100644
--- a/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp
+++ b/ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp
@@ -58,6 +58,7 @@
#include <NdbThread.h>
#include <NdbMutex.h>
#include <NdbApi.hpp>
+#include <NdbSchemaCon.hpp>
#include <NDBT.hpp>
#define MAXATTR 3
@@ -93,8 +94,8 @@ TTYPE t_addReg(int, NdbOperation*);
TTYPE t_subReg(int, NdbOperation*);
TTYPE t_subroutineWithBranchLabel(int, NdbOperation*);
-char tableName[MAXTABLES][MAXSTRLEN+1] = {0};
-char attrName[MAXATTR][MAXSTRLEN+1] = {0};
+char tableName[MAXSTRLEN+1];
+char attrName[MAXATTR][MAXSTRLEN+1];
int attrValue[NUMBEROFRECORDS] = {0};
int pkValue[NUMBEROFRECORDS] = {0};
const int tAttributeSize = 1 ;
@@ -105,11 +106,9 @@ int bTestPassed = 0;
int main(int argc, const char** argv) {
- int tTableId = 0;
int operationType = 0;
- int tupTest = 0 ;
- int scanTest = 0 ;
- bool loop = 0 ;
+ int tupTest = 0;
+ int scanTest = 0;
Ndb* pNdb = new Ndb("TEST_DB");
pNdb->init();
@@ -140,7 +139,7 @@ int main(int argc, const char** argv) {
setAttrNames() ;
setTableNames() ;
- const void * p = NDBT_Table::discoverTableFromDb(pNdb, tableName[0]);
+ const void * p = NDBT_Table::discoverTableFromDb(pNdb, tableName);
if (p != 0){
create_table(pNdb);
}
@@ -252,18 +251,17 @@ void create_table(Ndb* pMyNdb) {
***************************************************************/
int check = -1 ;
- NdbSchemaCon *MySchemaTransaction = NULL ;
NdbSchemaOp *MySchemaOp = NULL ;
- ndbout << endl << "Creating " << tableName[0] << " ... " << endl;
+ ndbout << endl << "Creating " << tableName << " ... " << endl;
- MySchemaTransaction = pMyNdb->startSchemaTransaction();
+ NdbSchemaCon* MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pMyNdb);
if(!MySchemaTransaction) error_handler(MySchemaTransaction->getNdbError(), NO_FAIL);
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( !MySchemaOp ) error_handler(MySchemaTransaction->getNdbError(), NO_FAIL);
// Create table
- check = MySchemaOp->createTable( tableName[0],
+ check = MySchemaOp->createTable( tableName,
8, // Table size
TupleKey, // Key Type
40 // Nr of Pages
@@ -305,7 +303,8 @@ void create_table(Ndb* pMyNdb) {
ndbout << tableName[0] << " created" << endl;
}
- pMyNdb->closeSchemaTransaction(MySchemaTransaction);
+
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return;
@@ -333,7 +332,7 @@ void write_rows (Ndb* pMyNdb) {
error_handler(pMyNdb->getNdbError(), NO_FAIL);
}//if
- MyOperation = MyTransaction->getNdbOperation(tableName[0]);
+ MyOperation = MyTransaction->getNdbOperation(tableName);
if (!MyOperation) {
error_handler(pMyNdb->getNdbError(), NO_FAIL);
}//if
@@ -366,9 +365,6 @@ void verify_deleted(Ndb* pMyNdb) {
int check = -1 ;
int loop_count_ops = nRecords;
- NdbRecAttr* tTmp;
- int readValue[MAXATTR];
- NdbConnection* pMyTransaction = NULL ;
NdbOperation* pMyOperation = NULL ;
ndbout << "Verifying deleted records..."<< flush;
@@ -378,7 +374,7 @@ void verify_deleted(Ndb* pMyNdb) {
NdbConnection* pMyTransaction = pMyNdb->startTransaction();
if (!pMyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL);
- pMyOperation = pMyTransaction->getNdbOperation(tableName[0]);
+ pMyOperation = pMyTransaction->getNdbOperation(tableName);
if (!pMyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL);
check = pMyOperation->readTuple();
@@ -421,7 +417,7 @@ void read_and_verify_rows(Ndb* pMyNdb, bool pre) {
pMyTransaction = pMyNdb->startTransaction();
if (!pMyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL);
- MyOp = pMyTransaction->getNdbOperation(tableName[0]);
+ MyOp = pMyTransaction->getNdbOperation(tableName);
if (!MyOp) error_handler( pMyTransaction->getNdbError(), NO_FAIL);
@@ -1232,14 +1228,13 @@ void scan_rows(Ndb* pMyNdb, int opType, int tupleType, int scanType) {
int readValue = 0 ;
int readValue2 = 0 ;
int scanCount = 0 ;
- NdbRecAttr* tTmp = NULL ;
TTYPE fail = NO_FAIL ;
for (int count=0 ; count < loop_count_ops ; count++) {
NdbConnection* MyTransaction = pMyNdb->startTransaction();
if (!MyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL);
- NdbOperation* MyOperation = MyTransaction->getNdbOperation(tableName[0]);
+ NdbOperation* MyOperation = MyTransaction->getNdbOperation(tableName);
if (!MyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL);
if (opType == 1)
@@ -1306,7 +1301,7 @@ void scan_rows(Ndb* pMyNdb, int opType, int tupleType, int scanType) {
}else{
// Sends the SCAN_NEXTREQ signal(s) and reads the answer in TRANS_ID signals.
// SCAN_TABCONF or SCAN_TABREF is the confirmation.
- while (eOf = MyTransaction->nextScanResult() == 0) {
+ while ((eOf = MyTransaction->nextScanResult()) == 0) {
ndbout << readValue <<"; ";
// Here we call takeOverScanOp for update of the tuple.
}
@@ -1348,7 +1343,7 @@ void update_rows(Ndb* pMyNdb, int tupleType, int opType) {
return;
}//if
- MyOperation = MyTransaction->getNdbOperation(tableName[0]);
+ MyOperation = MyTransaction->getNdbOperation(tableName);
if (MyOperation == NULL) {
error_handler(pMyNdb->getNdbError(), NO_FAIL);
return;
@@ -1442,7 +1437,7 @@ void delete_rows(Ndb* pMyNdb, int tupleTest, int opType) {
MyTransaction = pMyNdb->startTransaction();
if (!MyTransaction) error_handler(pMyNdb->getNdbError(), NO_FAIL) ;
- MyOperation = MyTransaction->getNdbOperation(tableName[0]);
+ MyOperation = MyTransaction->getNdbOperation(tableName);
if (!MyOperation) error_handler(pMyNdb->getNdbError(), NO_FAIL) ;
check = MyOperation->interpretedDeleteTuple();
@@ -1517,8 +1512,6 @@ inline void setAttrNames(){
inline void setTableNames(){
- for (int i = 0; i < MAXTABLES; i++){
- snprintf(tableName[i], MAXSTRLEN, "TAB%d", i);
- }
+ snprintf(tableName, MAXSTRLEN, "TAB1");
}
diff --git a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp b/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp
index 67c4e037215..fe3c17acbf5 100644
--- a/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp
+++ b/ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp
@@ -32,6 +32,7 @@
#include <NdbSleep.h>
#include "ndb_schema.hpp"
#include <NDBT.hpp>
+#include <NdbSchemaCon.hpp>
/***************************************************************
* L O C A L C O N S T A N T S *
@@ -141,13 +142,11 @@ extern int useIndexTables;
int
-create_table_server(Ndb * pNDB){
-
+create_table_server(Ndb * pNdb){
int check;
-
- NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction();
+ NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if( MySchemaTransaction == NULL )
- error_handler("startSchemaTransaction", pNDB->getNdbError(), 0);
+ error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL )
@@ -246,17 +245,17 @@ create_table_server(Ndb * pNDB){
error_handler("schemaTransaction->execute()",
MySchemaTransaction->getNdbError(), 0);
}
- pNDB->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return 0;
}
int
-create_table_group(Ndb * pNDB){
+create_table_group(Ndb * pNdb){
int check;
- NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction();
+ NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if( MySchemaTransaction == NULL )
- error_handler("startSchemaTransaction", pNDB->getNdbError(), 0);
+ error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL )
@@ -340,16 +339,16 @@ create_table_group(Ndb * pNDB){
error_handler("schemaTransaction->execute()",
MySchemaTransaction->getNdbError(), 0);
}
- pNDB->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return 0;
}
int
-create_table_subscriber(Ndb * pNDB){
+create_table_subscriber(Ndb * pNdb){
int check;
- NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction();
+ NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if( MySchemaTransaction == NULL )
- error_handler("startSchemaTransaction", pNDB->getNdbError(), 0);
+ error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL )
@@ -459,16 +458,16 @@ create_table_subscriber(Ndb * pNDB){
error_handler("schemaTransaction->execute()",
MySchemaTransaction->getNdbError(), 0);
}
- pNDB->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return 0;
}
int
-create_table_session(Ndb * pNDB){
+create_table_session(Ndb * pNdb){
int check;
- NdbSchemaCon * MySchemaTransaction = pNDB->startSchemaTransaction();
+ NdbSchemaCon * MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if( MySchemaTransaction == NULL )
- error_handler("startSchemaTransaction", pNDB->getNdbError(), 0);
+ error_handler("startSchemaTransaction", pNdb->getNdbError(), 0);
NdbSchemaOp * MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if( MySchemaOp == NULL )
@@ -533,29 +532,29 @@ create_table_session(Ndb * pNDB){
error_handler("schemaTransaction->execute()",
MySchemaTransaction->getNdbError(), 0);
}
- pNDB->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
return 0;
}
void
-create_table(const char * name, int (* function)(Ndb * pNDB), Ndb* pNDB){
+create_table(const char * name, int (* function)(Ndb * pNdb), Ndb* pNdb){
printf("creating table %s...", name);
- if(pNDB->getDictionary()->getTable(name) != 0){
+ if(pNdb->getDictionary()->getTable(name) != 0){
printf(" it already exists\n");
return;
} else {
printf("\n");
}
- function(pNDB);
+ function(pNdb);
printf("creating table %s... done\n", name);
}
-static int dbCreate(Ndb * pNDB)
+static int dbCreate(Ndb * pNdb)
{
- create_table(SUBSCRIBER_TABLE, create_table_subscriber, pNDB);
- create_table(GROUP_TABLE , create_table_group, pNDB);
- create_table(SESSION_TABLE , create_table_session, pNDB);
- create_table(SERVER_TABLE , create_table_server, pNDB);
+ create_table(SUBSCRIBER_TABLE, create_table_subscriber, pNdb);
+ create_table(GROUP_TABLE , create_table_group, pNdb);
+ create_table(SESSION_TABLE , create_table_session, pNdb);
+ create_table(SERVER_TABLE , create_table_server, pNdb);
return 0;
}
@@ -570,23 +569,23 @@ userDbConnect(uint32 createDb, char *dbName)
{
NdbMutex_Lock(startupMutex);
- Ndb * pNDB = new Ndb("");
+ Ndb * pNdb = new Ndb("");
//printf("Initializing...\n");
- pNDB->init();
+ pNdb->init();
//printf("Waiting...");
- while(pNDB->waitUntilReady() != 0){
+ while(pNdb->waitUntilReady() != 0){
//printf("...");
}
// printf("done\n");
if( createDb )
- dbCreate(pNDB);
+ dbCreate(pNdb);
UserHandle * uh = new UserHandle;
- uh->pNDB = pNDB;
+ uh->pNDB = pNdb;
uh->pCurrTrans = 0;
NdbMutex_Unlock(startupMutex);
diff --git a/ndb/test/ndbapi/ronja/initronja/initronja.cpp b/ndb/test/ndbapi/ronja/initronja/initronja.cpp
index f3f4d9628e2..b3215104822 100644
--- a/ndb/test/ndbapi/ronja/initronja/initronja.cpp
+++ b/ndb/test/ndbapi/ronja/initronja/initronja.cpp
@@ -21,6 +21,7 @@
* *************************************************** */
#include "NdbApi.hpp"
+#include "NdbSchemaCon.hpp"
#include <NdbOut.hpp>
#include <NdbMain.h>
#include <NdbTest.hpp>
@@ -90,7 +91,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
ndbout << endl << "Creating the table SHORT_REC" << "..." << endl;
- MySchemaTransaction = pNdb->startSchemaTransaction();
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if(!MySchemaTransaction) goto error_handler;
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
if(!MySchemaOp) goto error_handler;
@@ -148,11 +149,11 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
ndbout << "SHORT_REC created " << endl;
}// if
- pNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
ndbout << endl << "Creating the table LONG_REC..." << endl;
- MySchemaTransaction = pNdb->startSchemaTransaction();
+ MySchemaTransaction = NdbSchemaCon::startSchemaTrans(pNdb);
if(!MySchemaTransaction) goto error_handler;
MySchemaOp = MySchemaTransaction->getNdbSchemaOp();
@@ -212,7 +213,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
ndbout << "LONG_REC created" << endl;
}// if
- pNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
check = InsertRecords(pNdb, tNoOfRecords);
@@ -234,7 +235,7 @@ NDB_COMMAND(initronja, "initronja", "initronja", "initronja", 65535){
error_handler:
ndbout << "SchemaTransaction returned error:" ;
ndbout << MySchemaTransaction->getNdbError() << endl;
- pNdb->closeSchemaTransaction(MySchemaTransaction);
+ NdbSchemaCon::closeSchemaTrans(MySchemaTransaction);
delete pNdb ;
NDBT_ProgramExit(NDBT_FAILED) ;
exit(-1);
diff --git a/ndb/test/ndbapi/telco/msa.cpp b/ndb/test/ndbapi/telco/msa.cpp
index 39ddaac2019..7a734f9cb79 100644
--- a/ndb/test/ndbapi/telco/msa.cpp
+++ b/ndb/test/ndbapi/telco/msa.cpp
@@ -17,6 +17,7 @@
#include <ndb_global.h>
#include <NdbApi.hpp>
+#include <NdbSchemaCon.hpp>
#include <NdbCondition.h>
#include <NdbMutex.h>
#include <NdbSleep.h>
@@ -849,7 +850,7 @@ int CreateCallContextTable(Ndb* pNdb, const char* szTableName, bool bStored)
NdbError err;
memset(&err, 0, sizeof(err));
- NdbSchemaCon* pNdbSchemaCon = pNdb->startSchemaTransaction();
+ NdbSchemaCon* pNdbSchemaCon = NdbSchemaCon::startSchemaTrans(pNdb);
if(pNdbSchemaCon)
{
NdbSchemaOp* pNdbSchemaOp = pNdbSchemaCon->getNdbSchemaOp();
@@ -874,7 +875,8 @@ int CreateCallContextTable(Ndb* pNdb, const char* szTableName, bool bStored)
}
else
err = pNdbSchemaCon->getNdbError();
- pNdb->closeSchemaTransaction(pNdbSchemaCon);
+
+ NdbSchemaCon::closeSchemaTrans(pNdbSchemaCon);
}
else
err = pNdb->getNdbError();
diff --git a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp b/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp
index b8e0fef6cef..75773040113 100644
--- a/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp
+++ b/ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp
@@ -34,7 +34,7 @@
#include <NdbOut.hpp>
#include <NdbApi.hpp>
#include <NdbTest.hpp>
-
+#include <NdbSchemaCon.hpp>
// limits
static int const MaxAttr = 64;
static int const MaxOper = 1000;
@@ -99,7 +99,7 @@ ndberror(char const* fmt, ...)
if (tcon)
ndbout << "tcon: " << tcon->getNdbError() << endl;
if (top)
- ndbout << "top : " << top->getNdbError() << endl;
+ ndbout << "top: " << top->getNdbError() << endl;
if (con)
ndbout << "con : " << con->getNdbError() << endl;
if (op)
@@ -258,7 +258,7 @@ testcase(int flag)
if (ndb->waitUntilReady(30) < 0)
return ndberror("waitUntilReady");
- if ((tcon = ndb->startSchemaTransaction()) == 0)
+ if ((tcon = NdbSchemaCon::startSchemaTrans(ndb)) == 0)
return ndberror("startSchemaTransaction");
if ((top = tcon->getNdbSchemaOp()) == 0)
return ndberror("getNdbSchemaOp");
diff --git a/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp
index c0e262f590f..2e08ebbed4e 100644
--- a/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp
+++ b/ndb/test/ndbapi/testNdbApi/testNdbApi.cpp
@@ -23,8 +23,8 @@
#include <Vector.hpp>
#include <random.h>
#include <NdbTick.h>
-#include <AttrType.hpp>
+#define MAX_NDB_OBJECTS 32678
#define CHECK(b) if (!(b)) { \
ndbout << "ERR: "<< step->getName() \
@@ -79,7 +79,7 @@ int runTestMaxNdb(NDBT_Context* ctx, NDBT_Step* step){
ndbout << i << " ndb objects created" << endl;
- if (l > 0 && i != oldi && init != MAX_NO_THREADS){
+ if (l > 0 && i != oldi && init != MAX_NDB_OBJECTS){
ndbout << l << ": not as manyNdb objects created" << endl
<< i << " != " << oldi << endl;
result = NDBT_FAILED;
diff --git a/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp b/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp
index 1e36368ba62..e3dd1f8e2ce 100644
--- a/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp
+++ b/ndb/test/ndbapi/testRestartGci/testRestartGci.cpp
@@ -121,7 +121,7 @@ int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){
HugoOperations hugoOps(*ctx->getTab());
NdbRestarter restarter;
- int restartGCI = pNdb->NdbTamper(ReadRestartGCI, 0);
+ int restartGCI = pNdb->NdbTamper(Ndb::ReadRestartGCI, 0);
ndbout << "restartGCI = " << restartGCI << endl;
int count = 0;
diff --git a/ndb/test/src/NDBT_ResultRow.cpp b/ndb/test/src/NDBT_ResultRow.cpp
index ba46be203e1..c16b8968097 100644
--- a/ndb/test/src/NDBT_ResultRow.cpp
+++ b/ndb/test/src/NDBT_ResultRow.cpp
@@ -17,6 +17,7 @@
#include <ndb_global.h>
#include "NDBT_ResultRow.hpp"
#include <NdbOut.hpp>
+#include <NdbSchemaCon.hpp>
NDBT_ResultRow::NDBT_ResultRow(const NdbDictionary::Table& tab,
char attrib_delimiter)
@@ -109,6 +110,12 @@ BaseString NDBT_ResultRow::c_str() {
return str;
}
+
+/**
+ * TODO This could chare the sanme printer function as in
+ * NdbEventOperationImpl.cpp, using new types of course :)
+ */
+
NdbOut &
operator << (NdbOut& ndbout, const NDBT_ResultRow & res) {
for(int i = 0; i<res.cols; i++){
@@ -117,7 +124,7 @@ operator << (NdbOut& ndbout, const NDBT_ResultRow & res) {
else{
const int size = res.data[i]->attrSize();
const int aSize = res.data[i]->arraySize();
- switch(res.data[i]->attrType()){
+ switch(convertColumnTypeToAttrType(res.data[i]->getType())){
case UnSigned:
switch(size){
case 8:
@@ -174,7 +181,8 @@ operator << (NdbOut& ndbout, const NDBT_ResultRow & res) {
break;
default:
- ndbout << "Unknown(" << res.data[i]->attrType() << ")";
+ ndbout << "Unknown(" <<
+ convertColumnTypeToAttrType(res.data[i]->getType()) << ")";
break;
}
}
diff --git a/ndb/test/src/NDBT_Table.cpp b/ndb/test/src/NDBT_Table.cpp
index c520b01c990..48c8567e10e 100644
--- a/ndb/test/src/NDBT_Table.cpp
+++ b/ndb/test/src/NDBT_Table.cpp
@@ -26,7 +26,7 @@ operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){
bool key = attr.getPrimaryKey();
bool null = attr.getNullable();
- ndbout << attr.getName() << "\t";
+ ndbout << attr.getName() << " ";
char tmp[100];
if(attr.getLength() != 1)
snprintf(tmp, 100," [%d]", attr.getLength());
@@ -103,16 +103,16 @@ operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){
ndbout << "Unknown(" << type << ")";
}
- ndbout << "\t";
+ ndbout << " ";
if(null){
ndbout << "NULL";
} else {
ndbout << "NOT NULL";
}
- ndbout << "\t";
+ ndbout << " ";
if(key)
- ndbout << "\tprimary key";
+ ndbout << "PRIMARY KEY";
return ndbout;
}
@@ -130,6 +130,9 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab)
ndbout << "Temporary table: " << (tab.getStoredTable() ? "no" : "yes") << endl;
ndbout << "Number of attributes: " << tab.getNoOfColumns() << endl;
ndbout << "Number of primary keys: " << tab.getNoOfPrimaryKeys() << endl;
+ ndbout << "Length of frm data: " << tab.getFrmLength() << endl;
+
+
//<< ((tab.getTupleKey() == TupleId) ? " tupleid" : "") <<endl;
ndbout << "TableStatus: ";
switch(tab.getObjectStatus()){
@@ -154,3 +157,32 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab)
return ndbout;
}
+
+class NdbOut& operator <<(class NdbOut&, const NdbDictionary::Index & idx)
+{
+ ndbout << idx.getName();
+ ndbout << "(";
+ for (unsigned i=0; i < idx.getNoOfColumns(); i++)
+ {
+ const NdbDictionary::Column *col = idx.getColumn(i);
+ ndbout << col->getName();
+ if (i < idx.getNoOfColumns()-1)
+ ndbout << ", ";
+ }
+ ndbout << ")";
+
+ ndbout << " - ";
+ switch (idx.getType()) {
+ case NdbDictionary::Object::UniqueHashIndex:
+ ndbout << "UniqueHashIndex";
+ break;
+ case NdbDictionary::Object::OrderedIndex:
+ ndbout << "OrderedIndex";
+ break;
+ default:
+ ndbout << "Type " << idx.getType();
+ break;
+ }
+ return ndbout;
+}
+
diff --git a/ndb/test/src/UtilTransactions.cpp b/ndb/test/src/UtilTransactions.cpp
index 2e6ff360123..3ef31a2f535 100644
--- a/ndb/test/src/UtilTransactions.cpp
+++ b/ndb/test/src/UtilTransactions.cpp
@@ -980,8 +980,8 @@ UtilTransactions::verifyIndex(Ndb* pNdb,
}
switch (pIndex->getType()){
- case UniqueHashIndex:
- case OrderedIndex:
+ case NdbDictionary::Index::UniqueHashIndex:
+ case NdbDictionary::Index::OrderedIndex:
return verifyUniqueIndex(pNdb, indexName, parallelism, transactional);
break;
default:
diff --git a/ndb/tools/desc/desc.cpp b/ndb/tools/desc/desc.cpp
index 7481190614c..a5ff11edca9 100644
--- a/ndb/tools/desc/desc.cpp
+++ b/ndb/tools/desc/desc.cpp
@@ -19,19 +19,19 @@
#include <NdbApi.hpp>
+
+
int main(int argc, const char** argv){
const char* _tabname = NULL;
const char* _dbname = "TEST_DB";
- int _frm = 0;
int _unqualified = 0;
int _help = 0;
struct getargs args[] = {
- { "unqualified", 'u', arg_integer, &_unqualified, "unqualified",
+ { "unqualified", 'u', arg_flag, &_unqualified, "unqualified",
"Use unqualified table names"},
{ "database", 'd', arg_string, &_dbname, "dbname",
"Name of database table is in"},
- { "frm-data", 'f', arg_flag, &_frm, "Show frm data for table", "" } ,
{ "usage", '?', arg_flag, &_help, "Print help", "" }
};
int num_args = sizeof(args) / sizeof(args[0]);
@@ -62,15 +62,40 @@ int main(int argc, const char** argv){
NdbDictionary::Dictionary * dict = pMyNdb->getDictionary();
for (int i = optind; i < argc; i++) {
NDBT_Table* pTab = (NDBT_Table*)dict->getTable(argv[i]);
- if (pTab != 0) {
+ if (pTab != 0){
ndbout << (* pTab) << endl;
- if (_frm){
- ndbout << "getFrmLength: "<< endl
- << pTab->getFrmLength() << endl;
- }
- } else {
- ndbout << argv[i] << ": " << dict->getNdbError() << endl;
+
+ NdbDictionary::Dictionary::List list;
+ if (dict->listIndexes(list, argv[i]) != 0){
+ ndbout << argv[i] << ": " << dict->getNdbError() << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+
+ ndbout << "-- Indexes -- " << endl;
+ ndbout << "PRIMARY KEY(";
+ for (unsigned j= 0; j < pTab->getNoOfPrimaryKeys(); j++)
+ {
+ const NdbDictionary::Column * col = pTab->getColumn(j);
+ ndbout << col->getName();
+ if (j < pTab->getNoOfPrimaryKeys()-1)
+ ndbout << ", ";
+ }
+ ndbout << ") - UniqueHashIndex" << endl;
+
+ for (unsigned j= 0; j < list.count; j++) {
+ NdbDictionary::Dictionary::List::Element& elt = list.elements[j];
+ const NdbDictionary::Index *pIdx = dict->getIndex(elt.name, argv[i]);
+ if (!pIdx){
+ ndbout << argv[i] << ": " << dict->getNdbError() << endl;
+ return NDBT_ProgramExit(NDBT_FAILED);
+ }
+
+ ndbout << (*pIdx) << endl;
+ }
+ ndbout << endl;
}
+ else
+ ndbout << argv[i] << ": " << dict->getNdbError() << endl;
}
delete pMyNdb;