diff options
Diffstat (limited to 'ndb/include/ndbapi/NdbOperation.hpp')
-rw-r--r-- | ndb/include/ndbapi/NdbOperation.hpp | 110 |
1 files changed, 71 insertions, 39 deletions
diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp index 3c515fe84ef..cfa656cb2d5 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; @@ -29,6 +28,7 @@ class NdbRecAttr; class NdbOperation; class NdbConnection; class NdbColumnImpl; +class NdbBlob; /** * @class NdbOperation @@ -42,7 +42,8 @@ class NdbOperation friend class NdbScanReceiver; friend class NdbScanFilter; friend class NdbScanFilterImpl; - + friend class NdbBlob; + public: /** * @name Define Standard Operation Type @@ -526,6 +527,17 @@ public: virtual int setValue(Uint32 anAttrId, Int64 aValue); virtual int setValue(Uint32 anAttrId, float aValue); virtual int setValue(Uint32 anAttrId, double aValue); + + /** + * This method replaces getValue/setValue for blobs. It creates + * a blob handle NdbBlob. A second call with same argument returns + * the previously created handle. The handle is linked to the + * operation and is maintained automatically. + * + * See NdbBlob for details. + */ + virtual NdbBlob* getBlobHandle(const char* anAttrName); + virtual NdbBlob* getBlobHandle(Uint32 anAttrId); /** @} *********************************************************************/ /** @@ -833,8 +845,29 @@ public: */ int getNdbErrorLine(); + /** + * Get table name of this operation. + */ + const char* getTableName() const; + /** @} *********************************************************************/ + /** + * 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 +898,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 +928,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 @@ -924,6 +971,7 @@ protected: Uint32 len); NdbRecAttr* getValue(const NdbColumnImpl* anAttrObject, char* aValue = 0); int setValue(const NdbColumnImpl* anAttrObject, const char* aValue, Uint32 len); + NdbBlob* getBlobHandle(NdbConnection* aCon, const NdbColumnImpl* anAttrObject); int incValue(const NdbColumnImpl* anAttrObject, Uint32 aValue); int incValue(const NdbColumnImpl* anAttrObject, Uint64 aValue); int subValue(const NdbColumnImpl* anAttrObject, Uint32 aValue); @@ -968,6 +1016,10 @@ protected: NdbOperation* takeOverScanOp(OperationType opType, NdbConnection* updateTrans); + // get table or index key from prepared signals + int getKeyFromTCREQ(Uint32* data, unsigned size); + int getKeyFromKEYINFO20(Uint32* data, unsigned size); + /****************************************************************************** * These are the private variables that are defined in the operation objects. *****************************************************************************/ @@ -1013,18 +1065,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 @@ -1071,9 +1118,16 @@ protected: // saveBoundATTRINFO() moves ATTRINFO here when setBound() is ready NdbApiSignal* theBoundATTRINFO; Uint32 theTotalBoundAI_Len; + // Blobs in this operation + NdbBlob* theBlobList; }; +#ifdef NDB_NO_DROPPED_SIGNAL +#include <stdlib.h> +#endif + + inline int NdbOperation::checkMagicNumber() @@ -1094,16 +1148,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 +1189,7 @@ Parameters: aStatus: The status. Remark: Sets Operation status. ******************************************************************************/ inline -OperationStatus +NdbOperation::OperationStatus NdbOperation::Status() { return theStatus; @@ -1178,18 +1222,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) |