diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2004-09-28 17:35:07 +0000 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2004-09-28 17:35:07 +0000 |
commit | e8c4af1293bb1f1cb4e9ecc93367ec42013aac42 (patch) | |
tree | 5b381335aaa141c138b84b949ef467764a34ca23 /ndb | |
parent | 4888de1de9f1ff1b8d30a579a59566a27ed739af (diff) | |
download | mariadb-git-e8c4af1293bb1f1cb4e9ecc93367ec42013aac42.tar.gz |
set correct lockmode in all reads...
move lockmode from scan operation to operation
added read tuple with lock mode
ndb/include/ndbapi/NdbIndexOperation.hpp:
added read tuple with lock mode
ndb/include/ndbapi/NdbOperation.hpp:
move lockmode from scan operation to operation
ndb/include/ndbapi/NdbScanOperation.hpp:
move lockmode from scan operation to operation
ndb/src/ndbapi/NdbIndexOperation.cpp:
added read tuple with lock mode
ndb/src/ndbapi/NdbOperationDefine.cpp:
added read tuple with lock mode
sql/ha_ndbcluster.cc:
set correct lockmode in all reads...
moved lockmode from scan operatoin to operation
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/include/ndbapi/NdbIndexOperation.hpp | 9 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbOperation.hpp | 22 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbScanOperation.hpp | 12 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbIndexOperation.cpp | 5 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbOperationDefine.cpp | 18 |
5 files changed, 54 insertions, 12 deletions
diff --git a/ndb/include/ndbapi/NdbIndexOperation.hpp b/ndb/include/ndbapi/NdbIndexOperation.hpp index 36c3c73db2d..7612fe54d1b 100644 --- a/ndb/include/ndbapi/NdbIndexOperation.hpp +++ b/ndb/include/ndbapi/NdbIndexOperation.hpp @@ -56,6 +56,15 @@ public: * * @return 0 if successful otherwise -1. */ + int readTuple(LockMode); + + /** + * Define the NdbIndexOperation to be a standard operation of type readTuple. + * When calling NdbConnection::execute, this operation + * reads a tuple. + * + * @return 0 if successful otherwise -1. + */ int readTuple(); /** diff --git a/ndb/include/ndbapi/NdbOperation.hpp b/ndb/include/ndbapi/NdbOperation.hpp index 2d08fa57aae..a8bd8b9bfea 100644 --- a/ndb/include/ndbapi/NdbOperation.hpp +++ b/ndb/include/ndbapi/NdbOperation.hpp @@ -52,6 +52,19 @@ public: */ /** + * Lock when performing read + */ + + enum LockMode { + LM_Read = 0, + LM_Exclusive = 1, + LM_CommittedRead = 2, +#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL + LM_Dirty = 2 +#endif + }; + + /** * Define the NdbOperation to be a standard operation of type insertTuple. * When calling NdbConnection::execute, this operation * adds a new tuple to the table. @@ -94,6 +107,15 @@ public: * reads a tuple. * * @return 0 if successful otherwise -1. + */ + virtual int readTuple(LockMode); + + /** + * Define the NdbOperation to be a standard operation of type readTuple. + * When calling NdbConnection::execute, this operation + * reads a tuple. + * + * @return 0 if successful otherwise -1. */ virtual int readTuple(); diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp index 6ae71ef5aef..e8a4408469c 100644 --- a/ndb/include/ndbapi/NdbScanOperation.hpp +++ b/ndb/include/ndbapi/NdbScanOperation.hpp @@ -54,18 +54,6 @@ public: }; /** - * Lock when performing scan - */ - enum LockMode { - LM_Read = 0, - LM_Exclusive = 1, - LM_CommittedRead = 2, -#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL - LM_Dirty = 2 -#endif - }; - - /** * Type of cursor */ CursorType get_cursor_type() const; diff --git a/ndb/src/ndbapi/NdbIndexOperation.cpp b/ndb/src/ndbapi/NdbIndexOperation.cpp index bf4b07842f6..c62f6962e25 100644 --- a/ndb/src/ndbapi/NdbIndexOperation.cpp +++ b/ndb/src/ndbapi/NdbIndexOperation.cpp @@ -85,6 +85,11 @@ NdbIndexOperation::indxInit(const NdbIndexImpl * anIndex, return 0; } +int NdbIndexOperation::readTuple(NdbOperation::LockMode lm) +{ + return NdbOperation::readTuple(lm); +} + int NdbIndexOperation::readTuple() { // First check that index is unique diff --git a/ndb/src/ndbapi/NdbOperationDefine.cpp b/ndb/src/ndbapi/NdbOperationDefine.cpp index ad838ddd601..1cbfedd21b1 100644 --- a/ndb/src/ndbapi/NdbOperationDefine.cpp +++ b/ndb/src/ndbapi/NdbOperationDefine.cpp @@ -103,6 +103,24 @@ NdbOperation::writeTuple() * int readTuple(); *****************************************************************************/ int +NdbOperation::readTuple(NdbOperation::LockMode lm) +{ + switch(lm) { + case LM_Read: + return readTuple(); + break; + case LM_Exclusive: + return readTupleExclusive(); + break; + case LM_CommittedRead: + return readTuple(); + break; + }; +} +/****************************************************************************** + * int readTuple(); + *****************************************************************************/ +int NdbOperation::readTuple() { NdbConnection* tNdbCon = theNdbCon; |