diff options
author | unknown <mskold@mysql.com> | 2006-03-23 09:57:58 +0100 |
---|---|---|
committer | unknown <mskold@mysql.com> | 2006-03-23 09:57:58 +0100 |
commit | 576a856e3a5fcf519737a0852b3e88879626e56f (patch) | |
tree | f277a2752e1b6510c49d8279ef709acfc34f7975 /ndb | |
parent | 6e73098f85e50ee98a5c37bb0ef3a3dbf2c3c98f (diff) | |
download | mariadb-git-576a856e3a5fcf519737a0852b3e88879626e56f.tar.gz |
Added type tags to operations
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/include/ndbapi/NdbIndexOperation.hpp | 5 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbOperation.hpp | 47 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbScanOperation.hpp | 3 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbIndexOperation.cpp | 8 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbOperation.cpp | 3 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbScanOperation.cpp | 6 |
6 files changed, 64 insertions, 8 deletions
diff --git a/ndb/include/ndbapi/NdbIndexOperation.hpp b/ndb/include/ndbapi/NdbIndexOperation.hpp index a8a15978568..d16cd071f77 100644 --- a/ndb/include/ndbapi/NdbIndexOperation.hpp +++ b/ndb/include/ndbapi/NdbIndexOperation.hpp @@ -129,6 +129,11 @@ public: */ int deleteTuple(); + /** + * Get index object for this operation + */ + const NdbDictionary::Index * getIndex() const; + #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED /** * Define the NdbIndexOperation to be a standard operation of type diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp index 1035c642c97..6237740c3c6 100644 --- a/ndb/include/ndbapi/NdbOperation.hpp +++ b/ndb/include/ndbapi/NdbOperation.hpp @@ -56,9 +56,32 @@ public: */ /** - * Lock when performing read + * Different access types (supported by sub-classes of NdbOperation) */ + + enum Type { + PrimaryKeyAccess ///< Read, insert, update, or delete using pk +#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL + = 0 // NdbOperation +#endif + ,UniqueIndexAccess ///< Read, update, or delete using unique index +#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL + = 1 // NdbIndexOperation +#endif + ,TableScan ///< Full table scan +#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL + = 2 // NdbScanOperation +#endif + ,OrderedIndexScan ///< Ordered index scan +#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL + = 3 // NdbIndexScanOperation +#endif + }; + /** + * Lock when performing read + */ + enum LockMode { LM_Read ///< Read with shared lock #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL @@ -715,6 +738,11 @@ public: */ const NdbDictionary::Table * getTable() const; + /** + * Get the type of access for this operation + */ + const Type getType() const; + /** @} *********************************************************************/ #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL @@ -768,7 +796,7 @@ protected: int init(const class NdbTableImpl*, NdbTransaction* aCon); void initInterpreter(); - NdbOperation(Ndb* aNdb); + NdbOperation(Ndb* aNdb, Type aType = PrimaryKeyAccess); virtual ~NdbOperation(); void next(NdbOperation*); // Set next pointer NdbOperation* next(); // Get next pointer @@ -881,6 +909,8 @@ protected: * These are the private variables that are defined in the operation objects. *****************************************************************************/ + Type m_type; + NdbReceiver theReceiver; NdbError theError; // Errorcode @@ -1044,6 +1074,19 @@ NdbOperation::getFirstRecAttr() const } /****************************************************************************** +Type getType() + +Return Value Return the Type. +Remark: Gets type of access. +******************************************************************************/ +inline +const NdbOperation::Type +NdbOperation::getType() const +{ + return m_type; +} + +/****************************************************************************** OperationStatus Status(); Return Value Return the OperationStatus. diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp index bf8f362cefc..77b255dc2f4 100644 --- a/ndb/include/ndbapi/NdbScanOperation.hpp +++ b/ndb/include/ndbapi/NdbScanOperation.hpp @@ -177,7 +177,8 @@ public: int restart(bool forceSend = false); protected: - NdbScanOperation(Ndb* aNdb); + NdbScanOperation(Ndb* aNdb, + NdbOperation::Type aType = NdbOperation::TableScan); virtual ~NdbScanOperation(); int nextResultImpl(bool fetchAllowed = true, bool forceSend = false); diff --git a/ndb/src/ndbapi/NdbIndexOperation.cpp b/ndb/src/ndbapi/NdbIndexOperation.cpp index 4cedffed4a2..853bab09c41 100644 --- a/ndb/src/ndbapi/NdbIndexOperation.cpp +++ b/ndb/src/ndbapi/NdbIndexOperation.cpp @@ -26,7 +26,7 @@ #include <signaldata/IndxAttrInfo.hpp> NdbIndexOperation::NdbIndexOperation(Ndb* aNdb) : - NdbOperation(aNdb), + NdbOperation(aNdb, NdbOperation::UniqueIndexAccess), m_theIndex(NULL) { m_tcReqGSN = GSN_TCINDXREQ; @@ -164,6 +164,12 @@ int NdbIndexOperation::interpretedDeleteTuple() return NdbOperation::interpretedDeleteTuple(); } +const NdbDictionary::Index* +NdbIndexOperation::getIndex() const +{ + return m_theIndex; +} + int NdbIndexOperation::prepareSend(Uint32 aTC_ConnectPtr, Uint64 aTransactionId) { diff --git a/ndb/src/ndbapi/NdbOperation.cpp b/ndb/src/ndbapi/NdbOperation.cpp index c9143444908..ca08c39e070 100644 --- a/ndb/src/ndbapi/NdbOperation.cpp +++ b/ndb/src/ndbapi/NdbOperation.cpp @@ -37,7 +37,8 @@ * aTable: Pointers to the Table object * Remark: Creat an object of NdbOperation. ****************************************************************************/ -NdbOperation::NdbOperation(Ndb* aNdb) : +NdbOperation::NdbOperation(Ndb* aNdb, NdbOperation::Type aType) : + m_type(aType), theReceiver(aNdb), theErrorLine(0), theNdb(aNdb), diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index e0a480e02f7..9f8a2916d2f 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -37,8 +37,8 @@ #define DEBUG_NEXT_RESULT 0 -NdbScanOperation::NdbScanOperation(Ndb* aNdb) : - NdbOperation(aNdb), +NdbScanOperation::NdbScanOperation(Ndb* aNdb, NdbOperation::Type aType) : + NdbOperation(aNdb, aType), m_transConnection(NULL) { theParallelism = 0; @@ -1012,7 +1012,7 @@ NdbScanOperation::getBlobHandle(Uint32 anAttrId) } NdbIndexScanOperation::NdbIndexScanOperation(Ndb* aNdb) - : NdbScanOperation(aNdb) + : NdbScanOperation(aNdb, NdbOperation::OrderedIndexScan) { } |