summaryrefslogtreecommitdiff
path: root/ndb/include
diff options
context:
space:
mode:
authorunknown <magnus@neptunus.(none)>2004-05-25 11:53:07 +0200
committerunknown <magnus@neptunus.(none)>2004-05-25 11:53:07 +0200
commitaf81ff81b9610b446152171544474d3a3464397f (patch)
treef542d4418f9afce707a4fe5a728fef5bfcdb1497 /ndb/include
parent88a3b3bca81656e94ea5eca77172045d551f1411 (diff)
downloadmariadb-git-af81ff81b9610b446152171544474d3a3464397f.tar.gz
Removed AttrType.hpp and moved the "internal" datatypes to their corresponding class.
Moved NdbSchemaCon and NdbSchemaOp out of the public NdbApi, it can however still be used by old test programs. Added print oof indexes to desc. ndb/BinDist.sh: Removed AttrType.hpp from BinDist.sh ndb/include/ndbapi/Ndb.hpp: Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi Removed AttrType.hpp ndb/include/ndbapi/NdbApi.hpp: Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi Removed AttrType.hpp ndb/include/ndbapi/NdbConnection.hpp: Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi Removed AttrType.hpp Moved internal types to the class where they are used ndb/include/ndbapi/NdbIndexOperation.hpp: Use limit from ndbapi_limit.h ndb/include/ndbapi/NdbOperation.hpp: Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi Removed AttrType.hpp Remove faulty comment about how many attributes a key is allowed to consist of Removed unused member variables ndb/include/ndbapi/NdbRecAttr.hpp: Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi Removed AttrType.hpp ndb/include/ndbapi/NdbSchemaCon.hpp: Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi Removed AttrType.hpp ndb/include/ndbapi/NdbSchemaOp.hpp: Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi Removed AttrType.hpp Moved all "old" datatypes here, so if a test program is still using old type, include NdbSchemaCon.hpp ndb/include/ndbapi/ndbapi_limits.h: Corrected limitations, added some from AttrTyp.hpp ndb/src/Makefile: Remove newtonapi from Makefile ndb/src/kernel/blocks/backup/restore/Restore.hpp: Removed AttrType Include NdbSchemaCon since restore uses old types ndb/src/kernel/blocks/backup/restore/main.cpp: Include NdbOut ndb/src/mgmsrv/MgmtSrvr.cpp: Remov AttrType.hpp ndb/src/ndbapi/ClusterMgr.cpp: Remov AttrType.hpp ndb/src/ndbapi/Ndb.cpp: Removed NdbSchemaCon and NdbSchemaOp includes from public NdbApi Removed AttrType.hpp Moved internal types to the class where they are used ndb/src/ndbapi/NdbApiSignal.cpp: Removed AttrType.hpp ndb/src/ndbapi/NdbApiSignal.hpp: Removed AttrType.hpp ndb/src/ndbapi/NdbConnection.cpp: Moved internal type s to the class where they belong ndb/src/ndbapi/NdbDictionaryImpl.cpp: RemovedAttrType.hpp Use limits from ndbapi_limits.h ndb/src/ndbapi/NdbEventOperationImpl.cpp: Removed AttrType.hpp Moved printRecAttr to end since it depends on old types and need to include "NdbSchemaCon", function will be rewritten and moved to NdbRecAttr. It's also useful from other places where an attribute has been read into an NdbRecAttr. ndb/src/ndbapi/NdbIndexOperation.cpp: Use limitations from ndbapi_limits.h Moved internal tyeps to the class where they belongs ndb/src/ndbapi/NdbOperation.cpp: Use limits from ndbapi_limits.h ndb/src/ndbapi/NdbOperationDefine.cpp: Remove AttrType.hpp ndb/src/ndbapi/NdbOperationExec.cpp: Moved internal tyeps to the class where they belongs ndb/src/ndbapi/NdbOperationInt.cpp: RemovedAttrType.hpp Use limits from ndbapi_limits.h ndb/src/ndbapi/NdbOperationScan.cpp: RemovedAttrType.hpp Use limits from ndbapi_limits.h ndb/src/ndbapi/NdbOperationSearch.cpp: Removed AttrType.hpp Use limits from ndbapi_limits.h ndb/src/ndbapi/NdbResultSet.cpp: Moved the "internal" types to corresponding class ndb/src/ndbapi/NdbSchemaCon.cpp: Updated not to be included in public NdbApi ndb/src/ndbapi/NdbSchemaOp.cpp: Updated not to be included in public NdbApi ndb/src/ndbapi/NdbUtil.hpp: Removed AttrType.hpp ndb/src/ndbapi/Ndbif.cpp: Removed AttrType.hpp Removed NdbSchemaCon and NdbSchemaOp from public NdbApi Moved "interal" types to their corresponding class ndb/src/ndbapi/Ndbinit.cpp: Removed NdbSchemaCon and NdbSchemaOp from public NdbApi ndb/src/ndbapi/Ndblist.cpp: Removed NdbSchemaCon and NdbSchemaOp from public NdbApi Moved "internal" types to their corresponding class ndb/src/ndbapi/TransporterFacade.cpp: Removed AttrType.hpp ndb/src/ndbapi/TransporterFacade.hpp: Removed AttrType.hpp Moved internal definition of how many Ndb objects to create to here ndb/test/include/NDBT_Table.hpp: Removed old NdbSchema* Added function to print information about an index ndb/test/ndbapi/acid/acid.cpp: This test program uses old NdbScheaCon.hpp ndb/test/ndbapi/flexAsynch/flexAsynch.cpp: This test program uses old NdbScheaCon.hpp ndb/test/ndbapi/flexScan/flexScan.cpp: This test program uses old NdbScheaCon.hpp ndb/test/ndbapi/interpreterInTup/interpreterInTup.cpp: This test program uses old NdbScheaCon.hpp ndb/test/ndbapi/lmc-bench/src/user/userInterface.cpp: This test program uses old NdbScheaCon.hpp ndb/test/ndbapi/ronja/initronja/initronja.cpp: This test program uses old NdbScheaCon.hpp ndb/test/ndbapi/telco/msa.cpp: This test program uses old NdbScheaCon.hpp ndb/test/ndbapi/testDataBuffers/testDataBuffers.cpp: This test program uses old NdbScheaCon.hpp ndb/test/ndbapi/testNdbApi/testNdbApi.cpp: Remove AttrType.hpp Define max number of Ndb objects test should "try" to create. ndb/test/ndbapi/testRestartGci/testRestartGci.cpp: Moved "internal" datatypes to corresponding class, in this case Ndb class ndb/test/src/NDBT_ResultRow.cpp: This test program uses old NdbScheaCon.hpp But should soon use "printer" from NdbRecAttr ndb/test/src/NDBT_Table.cpp: Print table info more SQL like ndb/test/src/UtilTransactions.cpp: When AttrType.hpp, this hidden bug was discovered. Using wrong enum types in switch. ndb/tools/desc/desc.cpp: Alos print info about indexes for a table
Diffstat (limited to 'ndb/include')
-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
9 files changed, 325 insertions, 165 deletions
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