diff options
Diffstat (limited to 'ndb/include')
-rw-r--r-- | ndb/include/Makefile.am | 5 | ||||
-rw-r--r-- | ndb/include/ndbapi/AttrType.hpp | 329 | ||||
-rw-r--r-- | ndb/include/ndbapi/Ndb.hpp | 58 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbApi.hpp | 4 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbConnection.hpp | 83 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbIndexOperation.hpp | 2 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbOperation.hpp | 78 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbRecAttr.hpp | 36 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbSchemaCon.hpp | 25 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbSchemaOp.hpp | 185 | ||||
-rw-r--r-- | ndb/include/ndbapi/ndbapi_limits.h | 20 |
11 files changed, 330 insertions, 495 deletions
diff --git a/ndb/include/Makefile.am b/ndb/include/Makefile.am new file mode 100644 index 00000000000..5521035a479 --- /dev/null +++ b/ndb/include/Makefile.am @@ -0,0 +1,5 @@ + +noinst_HEADERS = + +# Don't update the files from bitkeeper +%::SCCS/s.% diff --git a/ndb/include/ndbapi/AttrType.hpp b/ndb/include/ndbapi/AttrType.hpp deleted file mode 100644 index e6e00c77130..00000000000 --- a/ndb/include/ndbapi/AttrType.hpp +++ /dev/null @@ -1,329 +0,0 @@ -/* Copyright (C) 2003 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/** - * @file AttrType.hpp - */ - -#ifndef AttrType_H -#define AttrType_H - -/** - * Max number of Ndb objects in different threads. - * (Ndb objects should not be shared by different threads.) - */ -const unsigned MAX_NO_THREADS = 4711; - -/** - * Max number of attributes in a table. - */ -const unsigned MAXNROFATTRIBUTES = 128; - -/** - * Max number of tuple keys for a table in NDB Cluster. - * - * A <em>tuple key</em> of a table is an attribute - * which is either part of the - * <em>primary key</em> or the <em>tuple id</em> of a table. - */ -const unsigned MAXNROFTUPLEKEY = 16; - -/** - * Max number of words in a tuple key attribute. - * - * Tuple keys can not have values larger than - * 4092 bytes (i.e. 1023 words). - */ -const unsigned MAXTUPLEKEYLENOFATTERIBUTEINWORD = 1023; - -/** - * Max number of ErrorCode in NDB Cluster range 0 - 1999. - */ -const unsigned MAXNDBCLUSTERERROR = 1999; - -/** - * Max number of theErrorCode NDB API range 4000 - 4999. - */ -const unsigned MAXNROFERRORCODE = 5000; - -/** - * <i>Missing explanation</i> - */ -enum ReturnType { - ReturnSuccess, ///< <i>Missing explanation</i> - ReturnFailure ///< <i>Missing explanation</i> -}; - -/** - * - */ -enum SendStatusType { - NotInit, ///< <i>Missing explanation</i> - InitState, ///< <i>Missing explanation</i> - sendOperations, ///< <i>Missing explanation</i> - sendCompleted, ///< <i>Missing explanation</i> - sendCOMMITstate, ///< <i>Missing explanation</i> - sendABORT, ///< <i>Missing explanation</i> - sendABORTfail, ///< <i>Missing explanation</i> - sendTC_ROLLBACK, ///< <i>Missing explanation</i> - sendTC_COMMIT, ///< <i>Missing explanation</i> - sendTC_OP ///< <i>Missing explanation</i> -}; - -/** - * <i>Missing explanation</i> - */ -enum ListState { - NotInList, ///< <i>Missing explanation</i> - InPreparedList, ///< <i>Missing explanation</i> - InSendList, ///< <i>Missing explanation</i> - InCompletedList ///< <i>Missing explanation</i> -}; - -/** - * Commit status of the transaction - */ -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> -}; - -/** - * 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; - -/** - * <i>Missing explanation</i> - */ -enum InitType { - NotConstructed, ///< <i>Missing explanation</i> - NotInitialised, ///< <i>Missing explanation</i> - StartingInit, ///< <i>Missing explanation</i> - Initialised, ///< <i>Missing explanation</i> - InitConfigError ///< <i>Missing explanation</i> -}; - -/** - * Type of attribute - */ -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 -}; - -/** - * 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 -}; - -/** - * 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) -}; - -/** - * <i>Missing explanation</i> - */ -enum OperationStatus{ - Init, ///< <i>Missing explanation</i> - OperationDefined, ///< <i>Missing explanation</i> - TupleKeyDefined, ///< <i>Missing explanation</i> - GetValue, ///< <i>Missing explanation</i> - SetValue, ///< <i>Missing explanation</i> - ExecInterpretedValue, ///< <i>Missing explanation</i> - SetValueInterpreted, ///< <i>Missing explanation</i> - FinalGetValue, ///< <i>Missing explanation</i> - SubroutineExec, ///< <i>Missing explanation</i> - SubroutineEnd, ///< <i>Missing explanation</i> - SetBound, ///< Setting bounds in range scan - WaitResponse, ///< <i>Missing explanation</i> - WaitCommitResponse, ///< <i>Missing explanation</i> - Finished, ///< <i>Missing explanation</i> - ReceiveFinished ///< <i>Missing explanation</i> -}; - -/** - * 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, ///< <i>Missing explanation</i> - NotDefined ///< <i>Missing explanation</i> -}; - -/** - * <i>Missing explanation</i> - */ -enum ConStatusType { - NotConnected, ///< <i>Missing explanation</i> - Connecting, ///< <i>Missing explanation</i> - Connected, ///< <i>Missing explanation</i> - DisConnecting, ///< <i>Missing explanation</i> - ConnectFailure ///< <i>Missing explanation</i> -}; - -/** - * <i>Missing explanation</i> - */ -enum CompletionStatus { - NotCompleted, ///< <i>Missing explanation</i> - CompletedSuccess, ///< <i>Missing explanation</i> - CompletedFailure, ///< <i>Missing explanation</i> - DefinitionFailure ///< <i>Missing explanation</i> -}; - -/** - * 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 -}; - -#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) -}; -#endif - -#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED -/** - * @deprecated - */ -enum NullAttributeType { - NoNullTypeDefined = -1, - NotNullAttribute, - NullAttribute, - AttributeDefined -}; -#endif - -#endif 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 0245859a632..d8c395162f6 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 @@ -834,7 +902,7 @@ Parameters: aStatus: The status. Remark: Sets Connect status. ******************************************************************************/ inline -ConStatusType +NdbConnection::ConStatusType NdbConnection::Status() { return theStatus; @@ -853,6 +921,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 0706afa5cb3..5fa903994b7 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 @@ -1099,16 +1123,6 @@ NdbOperation::setStartIndicator() theStartIndicator = 1; } -#if 0 -inline -void -NdbOperation::setCommitIndicator(CommitType aTypeOfCommit) -{ - theCommitIndicator = 1; - theCommitType = (Uint8)aTypeOfCommit; -} -#endif - inline int NdbOperation::getNdbErrorLine() @@ -1150,7 +1164,7 @@ Parameters: aStatus: The status. Remark: Sets Operation status. ******************************************************************************/ inline -OperationStatus +NdbOperation::OperationStatus NdbOperation::Status() { return theStatus; @@ -1183,18 +1197,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 bcfba7d3f9d..1cf2d9b342d 100644 --- a/ndb/include/ndbapi/ndbapi_limits.h +++ b/ndb/include/ndbapi/ndbapi_limits.h @@ -18,30 +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_CONNECTIONS 127 -#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 |