summaryrefslogtreecommitdiff
path: root/ndb/include
diff options
context:
space:
mode:
Diffstat (limited to 'ndb/include')
-rw-r--r--ndb/include/ndbapi/NdbIndexScanOperation.hpp7
-rw-r--r--ndb/include/ndbapi/NdbResultSet.hpp21
-rw-r--r--ndb/include/ndbapi/NdbScanOperation.hpp6
3 files changed, 29 insertions, 5 deletions
diff --git a/ndb/include/ndbapi/NdbIndexScanOperation.hpp b/ndb/include/ndbapi/NdbIndexScanOperation.hpp
index 7cd2daea6a6..e96f46e0f32 100644
--- a/ndb/include/ndbapi/NdbIndexScanOperation.hpp
+++ b/ndb/include/ndbapi/NdbIndexScanOperation.hpp
@@ -45,14 +45,15 @@ public:
NdbResultSet* readTuples(LockMode = LM_Read,
Uint32 batch = 0,
Uint32 parallel = 0,
- bool order_by = false);
+ bool order_by = false,
+ bool keyinfo = false);
inline NdbResultSet* readTuples(int parallell){
- return readTuples(LM_Read, 0, parallell, false);
+ return readTuples(LM_Read, 0, parallell);
}
inline NdbResultSet* readTuplesExclusive(int parallell = 0){
- return readTuples(LM_Exclusive, 0, parallell, false);
+ return readTuples(LM_Exclusive, 0, parallell);
}
/**
diff --git a/ndb/include/ndbapi/NdbResultSet.hpp b/ndb/include/ndbapi/NdbResultSet.hpp
index dc0288a380c..2a196b1c6ae 100644
--- a/ndb/include/ndbapi/NdbResultSet.hpp
+++ b/ndb/include/ndbapi/NdbResultSet.hpp
@@ -102,6 +102,27 @@ public:
int restart(bool forceSend = false);
/**
+ * Lock current row by transfering scan operation to a locking transaction.
+ * Use this function
+ * when a scan has found a record that you want to lock.
+ * 1. Start a new transaction.
+ * 2. Call the function takeOverForUpdate using your new transaction
+ * as parameter, all the properties of the found record will be copied
+ * to the new transaction.
+ * 3. When you execute the new transaction, the lock held by the scan will
+ * be transferred to the new transaction(it's taken over).
+ *
+ * @note You must have started the scan with openScanExclusive
+ * or explictly have requested keyinfo to be able to lock
+ * the found tuple.
+ *
+ * @param lockingTrans the locking transaction connection.
+ * @return an NdbOperation or NULL.
+ */
+ NdbOperation* lockTuple();
+ NdbOperation* lockTuple(NdbConnection* lockingTrans);
+
+ /**
* Transfer scan operation to an updating transaction. Use this function
* when a scan has found a record that you want to update.
* 1. Start a new transaction.
diff --git a/ndb/include/ndbapi/NdbScanOperation.hpp b/ndb/include/ndbapi/NdbScanOperation.hpp
index f6e68dd4abe..af656720efb 100644
--- a/ndb/include/ndbapi/NdbScanOperation.hpp
+++ b/ndb/include/ndbapi/NdbScanOperation.hpp
@@ -64,14 +64,16 @@ public:
* Tuples are not stored in NdbResultSet until execute(NoCommit)
* has been executed and nextResult has been called.
*
+ * @param keyinfo Return primary key, needed to be able to call lockTuple
* @param parallel Scan parallelism
* @param batch No of rows to fetch from each fragment at a time
* @param LockMode Scan lock handling
* @returns NdbResultSet.
- * @note specifying 0 for batch and parallall means max performance
+ * @note specifying 0 for batch and parallell means max performance
*/
NdbResultSet* readTuples(LockMode = LM_Read,
- Uint32 batch = 0, Uint32 parallel = 0);
+ Uint32 batch = 0, Uint32 parallel = 0,
+ bool keyinfo = false);
inline NdbResultSet* readTuples(int parallell){
return readTuples(LM_Read, 0, parallell);