diff options
author | unknown <mskold@mysql.com> | 2006-06-12 09:37:19 +0200 |
---|---|---|
committer | unknown <mskold@mysql.com> | 2006-06-12 09:37:19 +0200 |
commit | e3a975c5d6b92f951c2e2e811c2ae4f3e6fe61a3 (patch) | |
tree | 5b2d6993076fe52b35248ed22e5af5f8e3de027f /ndb | |
parent | b2d3ac1b6bd14493c03f6d58c624b47a3557e918 (diff) | |
download | mariadb-git-e3a975c5d6b92f951c2e2e811c2ae4f3e6fe61a3.tar.gz |
Fix for Bug #18184 SELECT ... FOR UPDATE does not work..: Adapted to 5.0 code changes
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/include/ndbapi/NdbIndexScanOperation.hpp | 7 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbScanOperation.hpp | 32 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbScanOperation.cpp | 2 |
3 files changed, 36 insertions, 5 deletions
diff --git a/ndb/include/ndbapi/NdbIndexScanOperation.hpp b/ndb/include/ndbapi/NdbIndexScanOperation.hpp index e9f92d84d1c..638ecb17779 100644 --- a/ndb/include/ndbapi/NdbIndexScanOperation.hpp +++ b/ndb/include/ndbapi/NdbIndexScanOperation.hpp @@ -61,11 +61,14 @@ public: Uint32 parallel, bool order_by, bool order_desc = false, - bool read_range_no = false) { + bool read_range_no = false, + bool keyinfo = false) { Uint32 scan_flags = (SF_OrderBy & -(Int32)order_by) | (SF_Descending & -(Int32)order_desc) | - (SF_ReadRangeNo & -(Int32)read_range_no); + (SF_ReadRangeNo & -(Int32)read_range_no) | + (SF_KeyInfo & -(Int32)keyinfo); + return readTuples(lock_mode, scan_flags, parallel); } #endif diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp index 6a393223c4c..4a8425852b9 100644 --- a/ndb/include/ndbapi/NdbScanOperation.hpp +++ b/ndb/include/ndbapi/NdbScanOperation.hpp @@ -44,7 +44,8 @@ public: SF_TupScan = (1 << 16), // scan TUP - only LM_CommittedRead SF_OrderBy = (1 << 24), // index scan in order SF_Descending = (2 << 24), // index scan in descending order - SF_ReadRangeNo = (4 << 24) // enable @ref get_range_no + SF_ReadRangeNo = (4 << 24), // enable @ref get_range_no + SF_KeyInfo = 1 // request KeyInfo to be sent back }; /** @@ -68,7 +69,7 @@ public: */ #ifdef ndb_readtuples_impossible_overload int readTuples(LockMode lock_mode = LM_Read, - Uint32 batch = 0, Uint32 parallel = 0); + Uint32 batch = 0, Uint32 parallel = 0, bool keyinfo = false); #endif inline int readTuples(int parallell){ @@ -141,6 +142,20 @@ public: void close(bool forceSend = false, bool releaseOp = false); /** + * Lock current tuple + * + * @return an NdbOperation or NULL. + */ + NdbOperation* lockCurrentTuple(); + /** + * Lock current tuple + * + * @param lockTrans Transaction that should perform the lock + * + * @return an NdbOperation or NULL. + */ + NdbOperation* lockCurrentTuple(NdbTransaction* lockTrans); + /** * Update current tuple * * @return an NdbOperation or NULL. @@ -250,6 +265,19 @@ protected: inline NdbOperation* +NdbScanOperation::lockCurrentTuple(){ + return lockCurrentTuple(m_transConnection); +} + +inline +NdbOperation* +NdbScanOperation::lockCurrentTuple(NdbTransaction* takeOverTrans){ + return takeOverScanOp(NdbOperation::ReadRequest, + takeOverTrans); +} + +inline +NdbOperation* NdbScanOperation::updateCurrentTuple(){ return updateCurrentTuple(m_transConnection); } diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index 8278264fca2..7d0712e117d 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -160,7 +160,7 @@ NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, return -1; } - m_keyInfo = (keyinfo || lockExcl) ? 1 : 0; + m_keyInfo = ((scan_flags & SF_KeyInfo) || lockExcl) ? 1 : 0; bool rangeScan = false; if (m_accessTable->m_indexType == NdbDictionary::Index::OrderedIndex) |