Commit 2cae258f authored by unknown's avatar unknown

wl2126 - ndb - fix last unhandled part of read_multi_range

  reading sorted multi_range with several range-scans


BitKeeper/deleted/.del-NdbResultSet.hpp~e0042f4c18088ff6:
  Delete: ndb/include/ndbapi/NdbResultSet.hpp
BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d:
  Delete: ndb/src/ndbapi/NdbResultSet.cpp
ndb/include/ndbapi/NdbApi.hpp:
  Remove NdbResultSet
ndb/include/ndbapi/NdbIndexScanOperation.hpp:
  Remove NdbResultSet
ndb/include/ndbapi/NdbScanOperation.hpp:
  Remove NdbResultSet
ndb/src/ndbapi/Makefile.am:
  Remove NdbResultSet
ndb/src/ndbapi/NdbConnection.cpp:
  Remove NdbResultSet
ndb/src/ndbapi/NdbIndexOperation.cpp:
  Remove NdbResultSet
ndb/src/ndbapi/NdbScanOperation.cpp:
  Remove NdbResultSet
ndb/test/include/HugoOperations.hpp:
  Remove NdbResultSet
ndb/test/ndbapi/ScanFunctions.hpp:
  Remove NdbResultSet
ndb/test/ndbapi/ScanInterpretTest.hpp:
  Remove NdbResultSet
ndb/test/ndbapi/bank/Bank.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/bank/BankLoad.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/slow_select.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/testBlobs.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/testDataBuffers.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/testDeadlock.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/testIndex.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/testOIBasic.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/testReadPerf.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/testScan.cpp:
  Remove NdbResultSet
ndb/test/ndbapi/testScanPerf.cpp:
  Remove NdbResultSet
ndb/test/src/HugoOperations.cpp:
  Remove NdbResultSet
ndb/test/src/HugoTransactions.cpp:
  Remove NdbResultSet
ndb/test/src/UtilTransactions.cpp:
  Remove NdbResultSet
ndb/tools/delete_all.cpp:
  Remove NdbResultSet
ndb/tools/select_all.cpp:
  Remove NdbResultSet
ndb/tools/select_count.cpp:
  Remove NdbResultSet
sql/ha_ndbcluster.cc:
  1) Fix a = 3 -> a= 3
  2) Impl. last part of wl2126
     ordered "multi ordered scan"
parent a01f0686
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "NdbIndexScanOperation.hpp" #include "NdbIndexScanOperation.hpp"
#include "NdbScanFilter.hpp" #include "NdbScanFilter.hpp"
#include "NdbRecAttr.hpp" #include "NdbRecAttr.hpp"
#include "NdbResultSet.hpp"
#include "NdbDictionary.hpp" #include "NdbDictionary.hpp"
#include "NdbEventOperation.hpp" #include "NdbEventOperation.hpp"
#include "NdbPool.hpp" #include "NdbPool.hpp"
......
...@@ -42,20 +42,20 @@ public: ...@@ -42,20 +42,20 @@ public:
* @returns NdbResultSet. * @returns NdbResultSet.
* @see NdbScanOperation::readTuples * @see NdbScanOperation::readTuples
*/ */
NdbResultSet* readTuples(LockMode = LM_Read, int readTuples(LockMode = LM_Read,
Uint32 batch = 0, Uint32 batch = 0,
Uint32 parallel = 0, Uint32 parallel = 0,
bool order_by = false, bool order_by = false,
bool read_range_no = false); bool read_range_no = false);
inline NdbResultSet* readTuples(int parallell){ inline int readTuples(int parallell){
return readTuples(LM_Read, 0, parallell, false); return readTuples(LM_Read, 0, parallell, false);
} }
inline NdbResultSet* readTuplesExclusive(int parallell = 0){ inline int readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell, false); return readTuples(LM_Exclusive, 0, parallell, false);
} }
/** /**
* Type of ordered index key bound. The values (0-4) will not change * Type of ordered index key bound. The values (0-4) will not change
* and can be used explicitly (e.g. they could be computed). * and can be used explicitly (e.g. they could be computed).
...@@ -125,7 +125,7 @@ public: ...@@ -125,7 +125,7 @@ public:
/** /**
* Return range no for current row * Return range no for current row
*/ */
Uint32 get_range_no(); int get_range_no();
bool getSorted() const { return m_ordered; } bool getSorted() const { return m_ordered; }
private: private:
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbResultSet.hpp
* Include:
* Link:
* Author: Martin Sköld
* Date: 2002-04-01
* Version: 0.1
* Description: Cursor class
* Documentation:
* Adjust: 2002-04-01 Martin Sköld First version.
****************************************************************************/
#ifndef NdbResultSet_H
#define NdbResultSet_H
#include <NdbScanOperation.hpp>
/**
* @class NdbResultSet
* @brief NdbResultSet contains a NdbScanOperation.
*/
class NdbResultSet
{
friend class NdbScanOperation;
public:
/**
* Get the next tuple in a scan transaction.
*
* After each call to NdbResult::nextResult
* the buffers and NdbRecAttr objects defined in
* NdbOperation::getValue are updated with values
* from the scanned tuple.
*
* @param fetchAllowed If set to false, then fetching is disabled
*
* The NDB API will contact the NDB Kernel for more tuples
* when necessary to do so unless you set the fetchAllowed
* to false.
* This will force NDB to process any records it
* already has in it's caches. When there are no more cached
* records it will return 2. You must then call nextResult
* with fetchAllowed = true in order to contact NDB for more
* records.
*
* fetchAllowed = false is useful when you want to update or
* delete all the records fetched in one transaction(This will save a
* lot of round trip time and make updates or deletes of scanned
* records a lot faster).
* While nextResult(false)
* returns 0 take over the record to another transaction. When
* nextResult(false) returns 2 you must execute and commit the other
* transaction. This will cause the locks to be transferred to the
* other transaction, updates or deletes will be made and then the
* locks will be released.
* After that, call nextResult(true) which will fetch new records and
* cache them in the NdbApi.
*
* @note If you don't take over the records to another transaction the
* locks on those records will be released the next time NDB Kernel
* is contacted for more records.
*
* @note Please contact for examples of efficient scan
* updates and deletes.
*
* @note See ndb/examples/ndbapi_scan_example for usage.
*
* @return
* - -1: if unsuccessful,<br>
* - 0: if another tuple was received, and<br>
* - 1: if there are no more tuples to scan.
* - 2: if there are no more cached records in NdbApi
*/
int nextResult(bool fetchAllowed = true, bool forceSend = false);
/**
* Close result set (scan)
*/
void close(bool forceSend = false);
/**
* Restart
*/
int restart(bool forceSend = false);
/**
* 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.
* 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
* to be able to update the found tuple.
*
* @param updateTrans the update transaction connection.
* @return an NdbOperation or NULL.
*/
NdbOperation* updateTuple();
NdbOperation* updateTuple(NdbConnection* updateTrans);
/**
* Transfer scan operation to a deleting transaction. Use this function
* when a scan has found a record that you want to delete.
* 1. Start a new transaction.
* 2. Call the function takeOverForDelete 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(its taken over).
*
* @note You must have started the scan with openScanExclusive
* to be able to delete the found tuple.
*
* @param deleteTrans the delete transaction connection.
* @return an NdbOperation or NULL.
*/
int deleteTuple();
int deleteTuple(NdbConnection* takeOverTransaction);
/**
* Get underlying operation
*/
NdbOperation* getOperation();
private:
NdbResultSet(NdbScanOperation*);
~NdbResultSet();
void init();
NdbScanOperation* m_operation;
};
inline
NdbOperation*
NdbResultSet::getOperation(){
return m_operation;
}
#endif
...@@ -45,20 +45,6 @@ class NdbScanOperation : public NdbOperation { ...@@ -45,20 +45,6 @@ class NdbScanOperation : public NdbOperation {
friend class NdbOperation; friend class NdbOperation;
friend class NdbBlob; friend class NdbBlob;
public: public:
/**
* Type of cursor
*/
enum CursorType {
NoCursor = 0,
ScanCursor = 1,
IndexCursor = 2
};
/**
* Type of cursor
*/
CursorType get_cursor_type() const;
/** /**
* readTuples returns a NdbResultSet where tuples are stored. * readTuples returns a NdbResultSet where tuples are stored.
* Tuples are not stored in NdbResultSet until execute(NoCommit) * Tuples are not stored in NdbResultSet until execute(NoCommit)
...@@ -67,33 +53,126 @@ public: ...@@ -67,33 +53,126 @@ public:
* @param parallel Scan parallelism * @param parallel Scan parallelism
* @param batch No of rows to fetch from each fragment at a time * @param batch No of rows to fetch from each fragment at a time
* @param LockMode Scan lock handling * @param LockMode Scan lock handling
* @returns NdbResultSet.
* @note specifying 0 for batch and parallall means max performance * @note specifying 0 for batch and parallall means max performance
*/ */
NdbResultSet* readTuples(LockMode = LM_Read, int readTuples(LockMode = LM_Read,
Uint32 batch = 0, Uint32 parallel = 0); Uint32 batch = 0, Uint32 parallel = 0);
inline NdbResultSet* readTuples(int parallell){ inline int readTuples(int parallell){
return readTuples(LM_Read, 0, parallell); return readTuples(LM_Read, 0, parallell);
} }
inline NdbResultSet* readTuplesExclusive(int parallell = 0){ inline int readTuplesExclusive(int parallell = 0){
return readTuples(LM_Exclusive, 0, parallell); return readTuples(LM_Exclusive, 0, parallell);
} }
NdbBlob* getBlobHandle(const char* anAttrName); NdbBlob* getBlobHandle(const char* anAttrName);
NdbBlob* getBlobHandle(Uint32 anAttrId); NdbBlob* getBlobHandle(Uint32 anAttrId);
protected: /**
CursorType m_cursor_type; * Get the next tuple in a scan transaction.
*
* After each call to NdbResult::nextResult
* the buffers and NdbRecAttr objects defined in
* NdbOperation::getValue are updated with values
* from the scanned tuple.
*
* @param fetchAllowed If set to false, then fetching is disabled
*
* The NDB API will contact the NDB Kernel for more tuples
* when necessary to do so unless you set the fetchAllowed
* to false.
* This will force NDB to process any records it
* already has in it's caches. When there are no more cached
* records it will return 2. You must then call nextResult
* with fetchAllowed = true in order to contact NDB for more
* records.
*
* fetchAllowed = false is useful when you want to update or
* delete all the records fetched in one transaction(This will save a
* lot of round trip time and make updates or deletes of scanned
* records a lot faster).
* While nextResult(false)
* returns 0 take over the record to another transaction. When
* nextResult(false) returns 2 you must execute and commit the other
* transaction. This will cause the locks to be transferred to the
* other transaction, updates or deletes will be made and then the
* locks will be released.
* After that, call nextResult(true) which will fetch new records and
* cache them in the NdbApi.
*
* @note If you don't take over the records to another transaction the
* locks on those records will be released the next time NDB Kernel
* is contacted for more records.
*
* @note Please contact for examples of efficient scan
* updates and deletes.
*
* @note See ndb/examples/ndbapi_scan_example for usage.
*
* @return
* - -1: if unsuccessful,<br>
* - 0: if another tuple was received, and<br>
* - 1: if there are no more tuples to scan.
* - 2: if there are no more cached records in NdbApi
*/
int nextResult(bool fetchAllowed = true, bool forceSend = false);
/**
* Close result set (scan)
*/
void close(bool forceSend = false);
/**
* Restart
*/
int restart(bool forceSend = false);
/**
* 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.
* 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
* to be able to update the found tuple.
*
* @param updateTrans the update transaction connection.
* @return an NdbOperation or NULL.
*/
NdbOperation* updateCurrentTuple();
NdbOperation* updateCurrentTuple(NdbConnection* updateTrans);
/**
* Transfer scan operation to a deleting transaction. Use this function
* when a scan has found a record that you want to delete.
* 1. Start a new transaction.
* 2. Call the function takeOverForDelete 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(its taken over).
*
* @note You must have started the scan with openScanExclusive
* to be able to delete the found tuple.
*
* @param deleteTrans the delete transaction connection.
* @return an NdbOperation or NULL.
*/
int deleteCurrentTuple();
int deleteCurrentTuple(NdbConnection* takeOverTransaction);
protected:
NdbScanOperation(Ndb* aNdb); NdbScanOperation(Ndb* aNdb);
virtual ~NdbScanOperation(); virtual ~NdbScanOperation();
int nextResult(bool fetchAllowed = true, bool forceSend = false); int nextResultImpl(bool fetchAllowed = true, bool forceSend = false);
virtual void release(); virtual void release();
void closeScan(bool forceSend = false);
int close_impl(class TransporterFacade*, bool forceSend = false); int close_impl(class TransporterFacade*, bool forceSend = false);
// Overloaded methods from NdbCursorOperation // Overloaded methods from NdbCursorOperation
...@@ -108,8 +187,6 @@ protected: ...@@ -108,8 +187,6 @@ protected:
virtual void setErrorCode(int aErrorCode); virtual void setErrorCode(int aErrorCode);
virtual void setErrorCodeAbort(int aErrorCode); virtual void setErrorCodeAbort(int aErrorCode);
NdbResultSet * m_resultSet;
NdbResultSet* getResultSet();
NdbConnection *m_transConnection; NdbConnection *m_transConnection;
// Scan related variables // Scan related variables
...@@ -157,14 +234,35 @@ protected: ...@@ -157,14 +234,35 @@ protected:
Uint32 m_ordered; Uint32 m_ordered;
Uint32 m_read_range_no; Uint32 m_read_range_no;
int restart(bool forceSend = false);
}; };
inline inline
NdbScanOperation::CursorType NdbOperation*
NdbScanOperation::get_cursor_type() const { NdbScanOperation::updateCurrentTuple(){
return m_cursor_type; return updateCurrentTuple(m_transConnection);
}
inline
NdbOperation*
NdbScanOperation::updateCurrentTuple(NdbConnection* takeOverTrans){
return takeOverScanOp(NdbOperation::UpdateRequest,
takeOverTrans);
}
inline
int
NdbScanOperation::deleteCurrentTuple(){
return deleteCurrentTuple(m_transConnection);
}
inline
int
NdbScanOperation::deleteCurrentTuple(NdbConnection * takeOverTrans){
void * res = takeOverScanOp(NdbOperation::DeleteRequest,
takeOverTrans);
if(res == 0)
return -1;
return 0;
} }
#endif #endif
...@@ -22,7 +22,6 @@ libndbapi_la_SOURCES = \ ...@@ -22,7 +22,6 @@ libndbapi_la_SOURCES = \
NdbOperationInt.cpp \ NdbOperationInt.cpp \
NdbOperationDefine.cpp \ NdbOperationDefine.cpp \
NdbOperationExec.cpp \ NdbOperationExec.cpp \
NdbResultSet.cpp \
NdbScanOperation.cpp NdbScanFilter.cpp \ NdbScanOperation.cpp NdbScanFilter.cpp \
NdbIndexOperation.cpp \ NdbIndexOperation.cpp \
NdbEventOperation.cpp \ NdbEventOperation.cpp \
......
...@@ -1109,7 +1109,6 @@ NdbConnection::getNdbIndexScanOperation(const NdbIndexImpl* index, ...@@ -1109,7 +1109,6 @@ NdbConnection::getNdbIndexScanOperation(const NdbIndexImpl* index,
if(tOp) if(tOp)
{ {
tOp->m_currentTable = table; tOp->m_currentTable = table;
tOp->m_cursor_type = NdbScanOperation::IndexCursor;
} }
return tOp; return tOp;
} else { } else {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <NdbIndexOperation.hpp> #include <NdbIndexOperation.hpp>
#include <NdbResultSet.hpp>
#include <Ndb.hpp> #include <Ndb.hpp>
#include <NdbConnection.hpp> #include <NdbConnection.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*****************************************************************************
* Name: NdbResultSet.cpp
* Include:
* Link:
* Author: UABMASD Martin Skld INN/V Alzato
* Date: 2002-04-01
* Version: 0.1
* Description: Cursor class
* Documentation:
* Adjust: 2002-04-01 UABMASD First version.
****************************************************************************/
#include <Ndb.hpp>
#include <NdbConnection.hpp>
#include <NdbResultSet.hpp>
#include <NdbBlob.hpp>
NdbResultSet::NdbResultSet(NdbScanOperation *owner)
: m_operation(owner)
{
}
NdbResultSet::~NdbResultSet()
{
}
void NdbResultSet::init()
{
}
int NdbResultSet::nextResult(bool fetchAllowed, bool forceSend)
{
int res;
if ((res = m_operation->nextResult(fetchAllowed, forceSend)) == 0) {
// handle blobs
NdbBlob* tBlob = m_operation->theBlobList;
while (tBlob != 0) {
if (tBlob->atNextResult() == -1)
return -1;
tBlob = tBlob->theNext;
}
/*
* Flush blob part ops on behalf of user because
* - nextResult is analogous to execute(NoCommit)
* - user is likely to want blob value before next execute
*/
if (m_operation->m_transConnection->executePendingBlobOps() == -1)
return -1;
return 0;
}
return res;
}
void NdbResultSet::close(bool forceSend)
{
m_operation->closeScan(forceSend);
}
NdbOperation*
NdbResultSet::updateTuple(){
return updateTuple(m_operation->m_transConnection);
}
NdbOperation*
NdbResultSet::updateTuple(NdbConnection* takeOverTrans){
return m_operation->takeOverScanOp(NdbOperation::UpdateRequest,
takeOverTrans);
}
int
NdbResultSet::deleteTuple(){
return deleteTuple(m_operation->m_transConnection);
}
int
NdbResultSet::deleteTuple(NdbConnection * takeOverTrans){
void * res = m_operation->takeOverScanOp(NdbOperation::DeleteRequest,
takeOverTrans);
if(res == 0)
return -1;
return 0;
}
int
NdbResultSet::restart(bool forceSend){
return m_operation->restart(forceSend);
}
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
#include <NdbScanOperation.hpp> #include <NdbScanOperation.hpp>
#include <NdbIndexScanOperation.hpp> #include <NdbIndexScanOperation.hpp>
#include <NdbConnection.hpp> #include <NdbConnection.hpp>
#include <NdbResultSet.hpp>
#include "NdbApiSignal.hpp" #include "NdbApiSignal.hpp"
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include "NdbDictionaryImpl.hpp" #include "NdbDictionaryImpl.hpp"
#include <NdbBlob.hpp>
#include <NdbRecAttr.hpp> #include <NdbRecAttr.hpp>
#include <NdbReceiver.hpp> #include <NdbReceiver.hpp>
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
NdbScanOperation::NdbScanOperation(Ndb* aNdb) : NdbScanOperation::NdbScanOperation(Ndb* aNdb) :
NdbOperation(aNdb), NdbOperation(aNdb),
m_resultSet(0),
m_transConnection(NULL) m_transConnection(NULL)
{ {
theParallelism = 0; theParallelism = 0;
...@@ -60,21 +59,8 @@ NdbScanOperation::~NdbScanOperation() ...@@ -60,21 +59,8 @@ NdbScanOperation::~NdbScanOperation()
theNdb->releaseNdbScanRec(m_receivers[i]); theNdb->releaseNdbScanRec(m_receivers[i]);
} }
delete[] m_array; delete[] m_array;
if (m_resultSet)
delete m_resultSet;
} }
NdbResultSet*
NdbScanOperation::getResultSet()
{
if (!m_resultSet)
m_resultSet = new NdbResultSet(this);
return m_resultSet;
}
void void
NdbScanOperation::setErrorCode(int aErrorCode){ NdbScanOperation::setErrorCode(int aErrorCode){
NdbConnection* tmp = theNdbCon; NdbConnection* tmp = theNdbCon;
...@@ -125,9 +111,10 @@ NdbScanOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection) ...@@ -125,9 +111,10 @@ NdbScanOperation::init(const NdbTableImpl* tab, NdbConnection* myConnection)
return 0; return 0;
} }
NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, int
Uint32 batch, NdbScanOperation::readTuples(NdbScanOperation::LockMode lm,
Uint32 parallel) Uint32 batch,
Uint32 parallel)
{ {
m_ordered = 0; m_ordered = 0;
Uint32 fragCount = m_currentTable->m_fragmentCount; Uint32 fragCount = m_currentTable->m_fragmentCount;
...@@ -142,7 +129,7 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, ...@@ -142,7 +129,7 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm,
// 3. theScanOp contains a NdbScanOperation // 3. theScanOp contains a NdbScanOperation
if (theNdbCon->theScanningOp != NULL){ if (theNdbCon->theScanningOp != NULL){
setErrorCode(4605); setErrorCode(4605);
return 0; return -1;
} }
theNdbCon->theScanningOp = this; theNdbCon->theScanningOp = this;
...@@ -167,7 +154,7 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, ...@@ -167,7 +154,7 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm,
break; break;
default: default:
setErrorCode(4003); setErrorCode(4003);
return 0; return -1;
} }
m_keyInfo = lockExcl ? 1 : 0; m_keyInfo = lockExcl ? 1 : 0;
...@@ -192,13 +179,13 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, ...@@ -192,13 +179,13 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm,
if(fix_receivers(parallel) == -1){ if(fix_receivers(parallel) == -1){
setErrorCodeAbort(4000); setErrorCodeAbort(4000);
return 0; return -1;
} }
theSCAN_TABREQ = (!theSCAN_TABREQ ? theNdb->getSignal() : theSCAN_TABREQ); theSCAN_TABREQ = (!theSCAN_TABREQ ? theNdb->getSignal() : theSCAN_TABREQ);
if (theSCAN_TABREQ == NULL) { if (theSCAN_TABREQ == NULL) {
setErrorCodeAbort(4000); setErrorCodeAbort(4000);
return 0; return -1;
}//if }//if
theSCAN_TABREQ->setSignal(GSN_SCAN_TABREQ); theSCAN_TABREQ->setSignal(GSN_SCAN_TABREQ);
...@@ -234,7 +221,7 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm, ...@@ -234,7 +221,7 @@ NdbResultSet* NdbScanOperation::readTuples(NdbScanOperation::LockMode lm,
theTotalNrOfKeyWordInSignal= 0; theTotalNrOfKeyWordInSignal= 0;
getFirstATTRINFOScan(); getFirstATTRINFOScan();
return getResultSet(); return 0;
} }
int int
...@@ -403,6 +390,29 @@ NdbScanOperation::executeCursor(int nodeId){ ...@@ -403,6 +390,29 @@ NdbScanOperation::executeCursor(int nodeId){
int NdbScanOperation::nextResult(bool fetchAllowed, bool forceSend) int NdbScanOperation::nextResult(bool fetchAllowed, bool forceSend)
{
int res;
if ((res = nextResultImpl(fetchAllowed, forceSend)) == 0) {
// handle blobs
NdbBlob* tBlob = theBlobList;
while (tBlob != 0) {
if (tBlob->atNextResult() == -1)
return -1;
tBlob = tBlob->theNext;
}
/*
* Flush blob part ops on behalf of user because
* - nextResult is analogous to execute(NoCommit)
* - user is likely to want blob value before next execute
*/
if (m_transConnection->executePendingBlobOps() == -1)
return -1;
return 0;
}
return res;
}
int NdbScanOperation::nextResultImpl(bool fetchAllowed, bool forceSend)
{ {
if(m_ordered) if(m_ordered)
return ((NdbIndexScanOperation*)this)->next_result_ordered(fetchAllowed, return ((NdbIndexScanOperation*)this)->next_result_ordered(fetchAllowed,
...@@ -622,11 +632,11 @@ NdbScanOperation::doSend(int ProcessorId) ...@@ -622,11 +632,11 @@ NdbScanOperation::doSend(int ProcessorId)
return 0; return 0;
} }
void NdbScanOperation::closeScan(bool forceSend) void NdbScanOperation::close(bool forceSend)
{ {
if(m_transConnection){ if(m_transConnection){
if(DEBUG_NEXT_RESULT) if(DEBUG_NEXT_RESULT)
ndbout_c("closeScan() theError.code = %d " ndbout_c("close() theError.code = %d "
"m_api_receivers_count = %d " "m_api_receivers_count = %d "
"m_conf_receivers_count = %d " "m_conf_receivers_count = %d "
"m_sent_receivers_count = %d", "m_sent_receivers_count = %d",
...@@ -657,7 +667,7 @@ NdbScanOperation::execCLOSE_SCAN_REP(){ ...@@ -657,7 +667,7 @@ NdbScanOperation::execCLOSE_SCAN_REP(){
void NdbScanOperation::release() void NdbScanOperation::release()
{ {
if(theNdbCon != 0 || m_transConnection != 0){ if(theNdbCon != 0 || m_transConnection != 0){
closeScan(); close();
} }
for(Uint32 i = 0; i<m_allocated_receivers; i++){ for(Uint32 i = 0; i<m_allocated_receivers; i++){
m_receivers[i]->release(); m_receivers[i]->release();
...@@ -1196,22 +1206,22 @@ error: ...@@ -1196,22 +1206,22 @@ error:
return -1; return -1;
} }
NdbResultSet* int
NdbIndexScanOperation::readTuples(LockMode lm, NdbIndexScanOperation::readTuples(LockMode lm,
Uint32 batch, Uint32 batch,
Uint32 parallel, Uint32 parallel,
bool order_by, bool order_by,
bool read_range_no){ bool read_range_no){
NdbResultSet * rs = NdbScanOperation::readTuples(lm, batch, 0); int res = NdbScanOperation::readTuples(lm, batch, 0);
if(read_range_no) if(read_range_no)
{ {
m_read_range_no = 1; m_read_range_no = 1;
Uint32 word = 0; Uint32 word = 0;
AttributeHeader::init(&word, AttributeHeader::RANGE_NO, 0); AttributeHeader::init(&word, AttributeHeader::RANGE_NO, 0);
if(insertATTRINFO(word) == -1) if(insertATTRINFO(word) == -1)
rs = 0; res = -1;
} }
if(rs && order_by){ if(!res && order_by){
m_ordered = 1; m_ordered = 1;
Uint32 cnt = m_accessTable->getNoOfColumns() - 1; Uint32 cnt = m_accessTable->getNoOfColumns() - 1;
m_sort_columns = cnt; // -1 for NDB$NODE m_sort_columns = cnt; // -1 for NDB$NODE
...@@ -1234,7 +1244,7 @@ NdbIndexScanOperation::readTuples(LockMode lm, ...@@ -1234,7 +1244,7 @@ NdbIndexScanOperation::readTuples(LockMode lm,
m_this_bound_start = 0; m_this_bound_start = 0;
m_first_bound_word = theKEYINFOptr; m_first_bound_word = theKEYINFOptr;
return rs; return res;
} }
void void
...@@ -1666,7 +1676,7 @@ NdbIndexScanOperation::end_of_bound(Uint32 no) ...@@ -1666,7 +1676,7 @@ NdbIndexScanOperation::end_of_bound(Uint32 no)
return -1; return -1;
} }
Uint32 int
NdbIndexScanOperation::get_range_no() NdbIndexScanOperation::get_range_no()
{ {
if(m_read_range_no) if(m_read_range_no)
...@@ -1687,5 +1697,5 @@ NdbIndexScanOperation::get_range_no() ...@@ -1687,5 +1697,5 @@ NdbIndexScanOperation::get_range_no()
return ret; return ret;
} }
} }
return 0; return -1;
} }
...@@ -95,7 +95,7 @@ protected: ...@@ -95,7 +95,7 @@ protected:
Vector<BaseString> savedRecords; Vector<BaseString> savedRecords;
struct RsPair { NdbResultSet* m_result_set; int records; }; struct RsPair { NdbScanOperation* m_result_set; int records; };
Vector<RsPair> m_result_sets; Vector<RsPair> m_result_sets;
Vector<RsPair> m_executed_result_sets; Vector<RsPair> m_executed_result_sets;
private: private:
......
...@@ -81,7 +81,6 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -81,7 +81,6 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
int check; int check;
NdbConnection *pTrans = 0; NdbConnection *pTrans = 0;
NdbScanOperation *pOp = 0; NdbScanOperation *pOp = 0;
NdbResultSet *rs = 0;
while (true){ while (true){
if (retryAttempt >= retryMax){ if (retryAttempt >= retryMax){
...@@ -111,12 +110,9 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -111,12 +110,9 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
if( pOp->readTuples(exclusive ?
rs = pOp->readTuples(exclusive ? NdbScanOperation::LM_Exclusive :
NdbScanOperation::LM_Exclusive : NdbScanOperation::LM_Read) ) {
NdbScanOperation::LM_Read);
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -125,8 +121,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -125,8 +121,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
if (action == OnlyOpenScanOnce){ if (action == OnlyOpenScanOnce){
// Call openScan one more time when it's already defined // Call openScan one more time when it's already defined
NdbResultSet* rs2 = pOp->readTuples(NdbScanOperation::LM_Read); if( pOp->readTuples(NdbScanOperation::LM_Read) ) {
if( rs2 == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -168,7 +163,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -168,7 +163,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
bool abortTrans = (action==CloseWithoutStop); bool abortTrans = (action==CloseWithoutStop);
int eof; int eof;
int rows = 0; int rows = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
while(eof == 0){ while(eof == 0){
rows++; rows++;
...@@ -178,7 +173,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -178,7 +173,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
if (action != CloseWithoutStop){ if (action != CloseWithoutStop){
// Test that we can closeTrans without stopScan // Test that we can closeTrans without stopScan
rs->close(); pOp->close();
if( check == -1 ) { if( check == -1 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
...@@ -201,7 +196,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -201,7 +196,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
} }
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
const NdbError err = pTrans->getNdbError(); const NdbError err = pTrans->getNdbError();
...@@ -211,7 +206,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -211,7 +206,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
// Be cruel, call nextScanResult after error // Be cruel, call nextScanResult after error
for(int i=0; i<10; i++){ for(int i=0; i<10; i++){
eof = rs->nextResult(); eof = pOp->nextResult();
if(eof == 0){ if(eof == 0){
g_err << "nextScanResult returned eof = " << eof << endl g_err << "nextScanResult returned eof = " << eof << endl
<< " That is an error when there are no more records" << endl; << " That is an error when there are no more records" << endl;
...@@ -241,7 +236,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb, ...@@ -241,7 +236,7 @@ ScanFunctions::scanReadFunctions(Ndb* pNdb,
if (action == NextScanWhenNoMore){ if (action == NextScanWhenNoMore){
g_info << "Calling nextScanresult when there are no more records" << endl; g_info << "Calling nextScanresult when there are no more records" << endl;
for(int i=0; i<10; i++){ for(int i=0; i<10; i++){
eof = rs->nextResult(); eof = pOp->nextResult();
if(eof == 0){ if(eof == 0){
g_err << "nextScanResult returned eof = " << eof << endl g_err << "nextScanResult returned eof = " << eof << endl
<< " That is an error when there are no more records" << endl; << " That is an error when there are no more records" << endl;
......
...@@ -227,10 +227,7 @@ ScanInterpretTest::scanRead(Ndb* pNdb, ...@@ -227,10 +227,7 @@ ScanInterpretTest::scanRead(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(NdbScanOperation::LM_Read, if( pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism) ) {
0, parallelism);
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -262,14 +259,14 @@ ScanInterpretTest::scanRead(Ndb* pNdb, ...@@ -262,14 +259,14 @@ ScanInterpretTest::scanRead(Ndb* pNdb,
int rows = 0; int rows = 0;
NdbConnection* pInsTrans; NdbConnection* pInsTrans;
while((eof = rs->nextResult(true)) == 0){ while((eof = pOp->nextResult(true)) == 0){
do { do {
rows++; rows++;
if (addRowToInsert(pNdb, pTrans) != 0){ if (addRowToInsert(pNdb, pTrans) != 0){
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
} }
} while((eof = rs->nextResult(false)) == 0); } while((eof = pOp->nextResult(false)) == 0);
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
if( check == -1 ) { if( check == -1 ) {
...@@ -349,9 +346,7 @@ ScanInterpretTest::scanReadVerify(Ndb* pNdb, ...@@ -349,9 +346,7 @@ ScanInterpretTest::scanReadVerify(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(NdbScanOperation::LM_Read, if( pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism) ) {
0, parallelism);
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -392,7 +387,7 @@ ScanInterpretTest::scanReadVerify(Ndb* pNdb, ...@@ -392,7 +387,7 @@ ScanInterpretTest::scanReadVerify(Ndb* pNdb,
NdbConnection* pExistTrans; NdbConnection* pExistTrans;
NdbConnection* pNoExistTrans; NdbConnection* pNoExistTrans;
while((eof = rs->nextResult(true)) == 0){ while((eof = pOp->nextResult(true)) == 0){
pExistTrans = pNdb->startTransaction(); pExistTrans = pNdb->startTransaction();
if (pExistTrans == NULL) { if (pExistTrans == NULL) {
const NdbError err = pNdb->getNdbError(); const NdbError err = pNdb->getNdbError();
...@@ -424,7 +419,7 @@ ScanInterpretTest::scanReadVerify(Ndb* pNdb, ...@@ -424,7 +419,7 @@ ScanInterpretTest::scanReadVerify(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
} }
} while((eof = rs->nextResult(false)) == 0); } while((eof = pOp->nextResult(false)) == 0);
// Execute the transaction containing reads of // Execute the transaction containing reads of
......
...@@ -669,8 +669,7 @@ int Bank::findLastGL(Uint64 &lastTime){ ...@@ -669,8 +669,7 @@ int Bank::findLastGL(Uint64 &lastTime){
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(); if( pOp->readTuples() ) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -699,7 +698,7 @@ int Bank::findLastGL(Uint64 &lastTime){ ...@@ -699,7 +698,7 @@ int Bank::findLastGL(Uint64 &lastTime){
int eof; int eof;
int rows = 0; int rows = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
lastTime = 0; lastTime = 0;
while(eof == 0){ while(eof == 0){
...@@ -709,7 +708,7 @@ int Bank::findLastGL(Uint64 &lastTime){ ...@@ -709,7 +708,7 @@ int Bank::findLastGL(Uint64 &lastTime){
if (t > lastTime) if (t > lastTime)
lastTime = t; lastTime = t;
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
...@@ -1001,8 +1000,7 @@ int Bank::sumTransactionsForGL(const Uint64 glTime, ...@@ -1001,8 +1000,7 @@ int Bank::sumTransactionsForGL(const Uint64 glTime,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuplesExclusive(); if( pOp->readTuplesExclusive()) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -1053,7 +1051,7 @@ int Bank::sumTransactionsForGL(const Uint64 glTime, ...@@ -1053,7 +1051,7 @@ int Bank::sumTransactionsForGL(const Uint64 glTime,
int eof; int eof;
int rows = 0; int rows = 0;
int rowsFound = 0; int rowsFound = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
while(eof == 0){ while(eof == 0){
rows++; rows++;
...@@ -1077,7 +1075,7 @@ int Bank::sumTransactionsForGL(const Uint64 glTime, ...@@ -1077,7 +1075,7 @@ int Bank::sumTransactionsForGL(const Uint64 glTime,
} }
} }
eof = rs->nextResult(); eof = pOp->nextResult();
if ((rows % 100) == 0){ if ((rows % 100) == 0){
// "refresh" ownner transaction every 100th row // "refresh" ownner transaction every 100th row
...@@ -1161,8 +1159,7 @@ int Bank::performValidateGL(Uint64 glTime){ ...@@ -1161,8 +1159,7 @@ int Bank::performValidateGL(Uint64 glTime){
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(); if( pOp->readTuples() ) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -1241,7 +1238,7 @@ int Bank::performValidateGL(Uint64 glTime){ ...@@ -1241,7 +1238,7 @@ int Bank::performValidateGL(Uint64 glTime){
int rows = 0; int rows = 0;
int countGlRecords = 0; int countGlRecords = 0;
int result = NDBT_OK; int result = NDBT_OK;
eof = rs->nextResult(); eof = pOp->nextResult();
while(eof == 0){ while(eof == 0){
rows++; rows++;
...@@ -1328,7 +1325,7 @@ int Bank::performValidateGL(Uint64 glTime){ ...@@ -1328,7 +1325,7 @@ int Bank::performValidateGL(Uint64 glTime){
} }
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
...@@ -1425,8 +1422,7 @@ int Bank::getOldestPurgedGL(const Uint32 accountType, ...@@ -1425,8 +1422,7 @@ int Bank::getOldestPurgedGL(const Uint32 accountType,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(); if( pOp->readTuples() ) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -1469,7 +1465,7 @@ int Bank::getOldestPurgedGL(const Uint32 accountType, ...@@ -1469,7 +1465,7 @@ int Bank::getOldestPurgedGL(const Uint32 accountType,
int eof; int eof;
int rows = 0; int rows = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
oldest = 0; oldest = 0;
while(eof == 0){ while(eof == 0){
...@@ -1483,7 +1479,7 @@ int Bank::getOldestPurgedGL(const Uint32 accountType, ...@@ -1483,7 +1479,7 @@ int Bank::getOldestPurgedGL(const Uint32 accountType,
if (t > oldest) if (t > oldest)
oldest = t; oldest = t;
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
...@@ -1517,8 +1513,7 @@ int Bank::getOldestNotPurgedGL(Uint64 &oldest, ...@@ -1517,8 +1513,7 @@ int Bank::getOldestNotPurgedGL(Uint64 &oldest,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(); if( pOp->readTuples() ) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -1561,7 +1556,7 @@ int Bank::getOldestNotPurgedGL(Uint64 &oldest, ...@@ -1561,7 +1556,7 @@ int Bank::getOldestNotPurgedGL(Uint64 &oldest,
int eof; int eof;
int rows = 0; int rows = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
oldest = (Uint64)-1; oldest = (Uint64)-1;
found = false; found = false;
...@@ -1578,7 +1573,7 @@ int Bank::getOldestNotPurgedGL(Uint64 &oldest, ...@@ -1578,7 +1573,7 @@ int Bank::getOldestNotPurgedGL(Uint64 &oldest,
accountTypeId = a; accountTypeId = a;
} }
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
...@@ -1614,8 +1609,7 @@ int Bank::checkNoTransactionsOlderThan(const Uint32 accountType, ...@@ -1614,8 +1609,7 @@ int Bank::checkNoTransactionsOlderThan(const Uint32 accountType,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(); if( pOp->readTuples() ) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -1659,7 +1653,7 @@ int Bank::checkNoTransactionsOlderThan(const Uint32 accountType, ...@@ -1659,7 +1653,7 @@ int Bank::checkNoTransactionsOlderThan(const Uint32 accountType,
int eof; int eof;
int rows = 0; int rows = 0;
int found = 0; int found = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
while(eof == 0){ while(eof == 0){
rows++; rows++;
...@@ -1675,7 +1669,7 @@ int Bank::checkNoTransactionsOlderThan(const Uint32 accountType, ...@@ -1675,7 +1669,7 @@ int Bank::checkNoTransactionsOlderThan(const Uint32 accountType,
<< " ti = " << ti << endl; << " ti = " << ti << endl;
found++; found++;
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
...@@ -1858,8 +1852,7 @@ int Bank::findTransactionsToPurge(const Uint64 glTime, ...@@ -1858,8 +1852,7 @@ int Bank::findTransactionsToPurge(const Uint64 glTime,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuplesExclusive(); if( pOp->readTuplesExclusive() ) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -1896,7 +1889,7 @@ int Bank::findTransactionsToPurge(const Uint64 glTime, ...@@ -1896,7 +1889,7 @@ int Bank::findTransactionsToPurge(const Uint64 glTime,
int eof; int eof;
int rows = 0; int rows = 0;
int rowsFound = 0; int rowsFound = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
while(eof == 0){ while(eof == 0){
rows++; rows++;
...@@ -1906,7 +1899,7 @@ int Bank::findTransactionsToPurge(const Uint64 glTime, ...@@ -1906,7 +1899,7 @@ int Bank::findTransactionsToPurge(const Uint64 glTime,
if (a == accountType && t == glTime){ if (a == accountType && t == glTime){
rowsFound++; rowsFound++;
// One record found // One record found
check = rs->deleteTuple(pTrans); check = pOp->deleteCurrentTuple(pTrans);
if (check == -1){ if (check == -1){
ERR(m_ndb.getNdbError()); ERR(m_ndb.getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
...@@ -1921,7 +1914,7 @@ int Bank::findTransactionsToPurge(const Uint64 glTime, ...@@ -1921,7 +1914,7 @@ int Bank::findTransactionsToPurge(const Uint64 glTime,
return NDBT_FAILED; return NDBT_FAILED;
} }
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
...@@ -2367,8 +2360,7 @@ int Bank::getSumAccounts(Uint32 &sumAccounts, ...@@ -2367,8 +2360,7 @@ int Bank::getSumAccounts(Uint32 &sumAccounts,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuplesExclusive(); if( pOp->readTuplesExclusive() ) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -2403,7 +2395,7 @@ int Bank::getSumAccounts(Uint32 &sumAccounts, ...@@ -2403,7 +2395,7 @@ int Bank::getSumAccounts(Uint32 &sumAccounts,
} }
int eof; int eof;
eof = rs->nextResult(); eof = pOp->nextResult();
while(eof == 0){ while(eof == 0){
Uint32 b = balanceRec->u_32_value(); Uint32 b = balanceRec->u_32_value();
...@@ -2415,7 +2407,7 @@ int Bank::getSumAccounts(Uint32 &sumAccounts, ...@@ -2415,7 +2407,7 @@ int Bank::getSumAccounts(Uint32 &sumAccounts,
// << ", sum="<< sumAccounts << endl; // << ", sum="<< sumAccounts << endl;
// Take over the operation so that the lock is kept in db // Take over the operation so that the lock is kept in db
NdbOperation* pLockOp = rs->updateTuple(pTrans); NdbOperation* pLockOp = pOp->updateCurrentTuple(pTrans);
if (pLockOp == NULL){ if (pLockOp == NULL){
ERR(m_ndb.getNdbError()); ERR(m_ndb.getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
...@@ -2441,7 +2433,7 @@ int Bank::getSumAccounts(Uint32 &sumAccounts, ...@@ -2441,7 +2433,7 @@ int Bank::getSumAccounts(Uint32 &sumAccounts,
return NDBT_FAILED; return NDBT_FAILED;
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
......
...@@ -342,8 +342,7 @@ int Bank::getBalanceForAccountType(const Uint32 accountType, ...@@ -342,8 +342,7 @@ int Bank::getBalanceForAccountType(const Uint32 accountType,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet* rs = pOp->readTuples(); if( pOp->readTuples() ) {
if( rs == 0 ) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
m_ndb.closeTransaction(pScanTrans); m_ndb.closeTransaction(pScanTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -379,7 +378,7 @@ int Bank::getBalanceForAccountType(const Uint32 accountType, ...@@ -379,7 +378,7 @@ int Bank::getBalanceForAccountType(const Uint32 accountType,
int eof; int eof;
int rows = 0; int rows = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
while(eof == 0){ while(eof == 0){
rows++; rows++;
...@@ -391,7 +390,7 @@ int Bank::getBalanceForAccountType(const Uint32 accountType, ...@@ -391,7 +390,7 @@ int Bank::getBalanceForAccountType(const Uint32 accountType,
balance += b; balance += b;
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
ERR(pScanTrans->getNdbError()); ERR(pScanTrans->getNdbError());
......
...@@ -8,18 +8,17 @@ S_Scan { ...@@ -8,18 +8,17 @@ S_Scan {
const char * m_table; const char * m_table;
const char * m_index; const char * m_index;
NdbIndexScanOperation * m_scan; NdbIndexScanOperation * m_scan;
NdbResultSet * m_result;
Uint32 metaid; Uint32 metaid;
Uint32 match_count; Uint32 match_count;
Uint32 row_count; Uint32 row_count;
}; };
static S_Scan g_scans[] = { static S_Scan g_scans[] = {
{ "affiliatestometa", "ind_affiliatestometa", 0, 0, 0, 0, 0 }, { "affiliatestometa", "ind_affiliatestometa", 0, 0, 0, 0 },
{ "media", "metaid", 0, 0, 0, 0, 0 }, { "media", "metaid", 0, 0, 0, 0 },
{ "meta", "PRIMARY", 0, 0, 0, 0, 0 }, { "meta", "PRIMARY", 0, 0, 0, 0 },
{ "artiststometamap", "PRIMARY", 0, 0, 0, 0, 0 }, { "artiststometamap", "PRIMARY", 0, 0, 0, 0 },
{ "subgenrestometamap", "metaid", 0, 0, 0, 0, 0 } { "subgenrestometamap", "metaid", 0, 0, 0, 0 }
}; };
#define require(x) if(!(x)) { ndbout << "LINE: " << __LINE__ << endl;abort(); } #define require(x) if(!(x)) { ndbout << "LINE: " << __LINE__ << endl;abort(); }
...@@ -58,9 +57,8 @@ main(void){ ...@@ -58,9 +57,8 @@ main(void){
g_scans[i].m_table); g_scans[i].m_table);
NdbIndexScanOperation* scan = g_scans[i].m_scan; NdbIndexScanOperation* scan = g_scans[i].m_scan;
require(scan); require(scan);
g_scans[i].m_result = scan->readTuples(NdbScanOperation::LM_CommittedRead, require(scan->readTuples(NdbScanOperation::LM_CommittedRead,
0, 0, true); 0, 0, true) == 0);
require(g_scans[i].m_result);
} }
require(!g_scans[0].m_scan->setBound((Uint32)0, require(!g_scans[0].m_scan->setBound((Uint32)0,
...@@ -125,7 +123,7 @@ main(void){ ...@@ -125,7 +123,7 @@ main(void){
//ndbout_c("%s - %d", g_scans[i].m_table, g_scans[i].metaid); //ndbout_c("%s - %d", g_scans[i].m_table, g_scans[i].metaid);
for(i = 0; i<prev_F_sz; i++){ for(i = 0; i<prev_F_sz; i++){
int res = F[i]->m_result->nextResult(); int res = F[i]->m_scan->nextResult();
if(res == -1) if(res == -1)
abort(); abort();
......
...@@ -739,10 +739,9 @@ verifyBlobTable(const Bcol& b, const Bval& v, Uint32 pk1, bool exists) ...@@ -739,10 +739,9 @@ verifyBlobTable(const Bcol& b, const Bval& v, Uint32 pk1, bool exists)
NdbRecAttr* ra_pk; NdbRecAttr* ra_pk;
NdbRecAttr* ra_part; NdbRecAttr* ra_part;
NdbRecAttr* ra_data; NdbRecAttr* ra_data;
NdbResultSet* rs;
CHK((g_con = g_ndb->startTransaction()) != 0); CHK((g_con = g_ndb->startTransaction()) != 0);
CHK((g_ops = g_con->getNdbScanOperation(b.m_btname)) != 0); CHK((g_ops = g_con->getNdbScanOperation(b.m_btname)) != 0);
CHK((rs = g_ops->readTuples()) != 0); CHK(g_ops->readTuples() == 0);
CHK((ra_pk = g_ops->getValue("PK")) != 0); CHK((ra_pk = g_ops->getValue("PK")) != 0);
CHK((ra_part = g_ops->getValue("PART")) != 0); CHK((ra_part = g_ops->getValue("PART")) != 0);
CHK((ra_data = g_ops->getValue("DATA")) != 0); CHK((ra_data = g_ops->getValue("DATA")) != 0);
...@@ -756,7 +755,7 @@ verifyBlobTable(const Bcol& b, const Bval& v, Uint32 pk1, bool exists) ...@@ -756,7 +755,7 @@ verifyBlobTable(const Bcol& b, const Bval& v, Uint32 pk1, bool exists)
memset(seen, 0, partcount); memset(seen, 0, partcount);
while (1) { while (1) {
int ret; int ret;
CHK((ret = rs->nextResult()) == 0 || ret == 1); CHK((ret = g_ops->nextResult()) == 0 || ret == 1);
if (ret == 1) if (ret == 1)
break; break;
if (pk1 != ra_pk->u_32_value()) if (pk1 != ra_pk->u_32_value())
...@@ -1104,14 +1103,13 @@ readScan(int style, bool idx) ...@@ -1104,14 +1103,13 @@ readScan(int style, bool idx)
DBG("--- " << "readScan" << (idx ? "Idx" : "") << " " << stylename[style] << " ---"); DBG("--- " << "readScan" << (idx ? "Idx" : "") << " " << stylename[style] << " ---");
Tup tup; Tup tup;
tup.alloc(); // allocate buffers tup.alloc(); // allocate buffers
NdbResultSet* rs;
CHK((g_con = g_ndb->startTransaction()) != 0); CHK((g_con = g_ndb->startTransaction()) != 0);
if (! idx) { if (! idx) {
CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_tname)) != 0); CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_tname)) != 0);
} else { } else {
CHK((g_ops = g_con->getNdbIndexScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0); CHK((g_ops = g_con->getNdbIndexScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0);
} }
CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Read)) != 0); CHK(g_ops->readTuples(NdbScanOperation::LM_Read) == 0);
CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0); CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0);
if (g_opt.m_pk2len != 0) if (g_opt.m_pk2len != 0)
CHK(g_ops->getValue("PK2", tup.m_pk2) != 0); CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
...@@ -1127,7 +1125,7 @@ readScan(int style, bool idx) ...@@ -1127,7 +1125,7 @@ readScan(int style, bool idx)
int ret; int ret;
tup.m_pk1 = (Uint32)-1; tup.m_pk1 = (Uint32)-1;
memset(tup.m_pk2, 'x', g_opt.m_pk2len); memset(tup.m_pk2, 'x', g_opt.m_pk2len);
CHK((ret = rs->nextResult(true)) == 0 || ret == 1); CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
if (ret == 1) if (ret == 1)
break; break;
DBG("readScan" << (idx ? "Idx" : "") << " pk1=" << hex << tup.m_pk1); DBG("readScan" << (idx ? "Idx" : "") << " pk1=" << hex << tup.m_pk1);
...@@ -1157,14 +1155,13 @@ updateScan(int style, bool idx) ...@@ -1157,14 +1155,13 @@ updateScan(int style, bool idx)
DBG("--- " << "updateScan" << (idx ? "Idx" : "") << " " << stylename[style] << " ---"); DBG("--- " << "updateScan" << (idx ? "Idx" : "") << " " << stylename[style] << " ---");
Tup tup; Tup tup;
tup.alloc(); // allocate buffers tup.alloc(); // allocate buffers
NdbResultSet* rs;
CHK((g_con = g_ndb->startTransaction()) != 0); CHK((g_con = g_ndb->startTransaction()) != 0);
if (! idx) { if (! idx) {
CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_tname)) != 0); CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_tname)) != 0);
} else { } else {
CHK((g_ops = g_con->getNdbIndexScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0); CHK((g_ops = g_con->getNdbIndexScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0);
} }
CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Exclusive)) != 0); CHK(g_ops->readTuples(NdbScanOperation::LM_Exclusive) == 0);
CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0); CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0);
if (g_opt.m_pk2len != 0) if (g_opt.m_pk2len != 0)
CHK(g_ops->getValue("PK2", tup.m_pk2) != 0); CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
...@@ -1174,7 +1171,7 @@ updateScan(int style, bool idx) ...@@ -1174,7 +1171,7 @@ updateScan(int style, bool idx)
int ret; int ret;
tup.m_pk1 = (Uint32)-1; tup.m_pk1 = (Uint32)-1;
memset(tup.m_pk2, 'x', g_opt.m_pk2len); memset(tup.m_pk2, 'x', g_opt.m_pk2len);
CHK((ret = rs->nextResult(true)) == 0 || ret == 1); CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
if (ret == 1) if (ret == 1)
break; break;
DBG("updateScan" << (idx ? "Idx" : "") << " pk1=" << hex << tup.m_pk1); DBG("updateScan" << (idx ? "Idx" : "") << " pk1=" << hex << tup.m_pk1);
...@@ -1183,7 +1180,7 @@ updateScan(int style, bool idx) ...@@ -1183,7 +1180,7 @@ updateScan(int style, bool idx)
// calculate new blob values // calculate new blob values
calcBval(g_tups[k], false); calcBval(g_tups[k], false);
tup.copyfrom(g_tups[k]); tup.copyfrom(g_tups[k]);
CHK((g_opr = rs->updateTuple()) != 0); CHK((g_opr = g_ops->updateCurrentTuple()) != 0);
CHK(getBlobHandles(g_opr) == 0); CHK(getBlobHandles(g_opr) == 0);
if (style == 0) { if (style == 0) {
CHK(setBlobValue(tup) == 0); CHK(setBlobValue(tup) == 0);
...@@ -1210,14 +1207,13 @@ deleteScan(bool idx) ...@@ -1210,14 +1207,13 @@ deleteScan(bool idx)
{ {
DBG("--- " << "deleteScan" << (idx ? "Idx" : "") << " ---"); DBG("--- " << "deleteScan" << (idx ? "Idx" : "") << " ---");
Tup tup; Tup tup;
NdbResultSet* rs;
CHK((g_con = g_ndb->startTransaction()) != 0); CHK((g_con = g_ndb->startTransaction()) != 0);
if (! idx) { if (! idx) {
CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_tname)) != 0); CHK((g_ops = g_con->getNdbScanOperation(g_opt.m_tname)) != 0);
} else { } else {
CHK((g_ops = g_con->getNdbIndexScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0); CHK((g_ops = g_con->getNdbIndexScanOperation(g_opt.m_x2name, g_opt.m_tname)) != 0);
} }
CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Exclusive)) != 0); CHK(g_ops->readTuples(NdbScanOperation::LM_Exclusive) == 0);
CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0); CHK(g_ops->getValue("PK1", (char*)&tup.m_pk1) != 0);
if (g_opt.m_pk2len != 0) if (g_opt.m_pk2len != 0)
CHK(g_ops->getValue("PK2", tup.m_pk2) != 0); CHK(g_ops->getValue("PK2", tup.m_pk2) != 0);
...@@ -1227,11 +1223,11 @@ deleteScan(bool idx) ...@@ -1227,11 +1223,11 @@ deleteScan(bool idx)
int ret; int ret;
tup.m_pk1 = (Uint32)-1; tup.m_pk1 = (Uint32)-1;
memset(tup.m_pk2, 'x', g_opt.m_pk2len); memset(tup.m_pk2, 'x', g_opt.m_pk2len);
CHK((ret = rs->nextResult()) == 0 || ret == 1); CHK((ret = g_ops->nextResult()) == 0 || ret == 1);
if (ret == 1) if (ret == 1)
break; break;
DBG("deleteScan" << (idx ? "Idx" : "") << " pk1=" << hex << tup.m_pk1); DBG("deleteScan" << (idx ? "Idx" : "") << " pk1=" << hex << tup.m_pk1);
CHK(rs->deleteTuple() == 0); CHK(g_ops->deleteCurrentTuple() == 0);
CHK(g_con->execute(NoCommit) == 0); CHK(g_con->execute(NoCommit) == 0);
Uint32 k = tup.m_pk1 - g_opt.m_pk1off; Uint32 k = tup.m_pk1 - g_opt.m_pk1off;
CHK(k < g_opt.m_rows && g_tups[k].m_exists); CHK(k < g_opt.m_rows && g_tups[k].m_exists);
...@@ -1608,12 +1604,11 @@ testperf() ...@@ -1608,12 +1604,11 @@ testperf()
// scan read char // scan read char
{ {
DBG("--- scan read char ---"); DBG("--- scan read char ---");
NdbResultSet* rs;
Uint32 a; Uint32 a;
char b[20]; char b[20];
CHK((g_con = g_ndb->startTransaction()) != 0); CHK((g_con = g_ndb->startTransaction()) != 0);
CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0); CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0);
CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Read)) != 0); CHK(g_ops->readTuples(NdbScanOperation::LM_Read) == 0);
CHK(g_ops->getValue(cA, (char*)&a) != 0); CHK(g_ops->getValue(cA, (char*)&a) != 0);
CHK(g_ops->getValue(cB, b) != 0); CHK(g_ops->getValue(cB, b) != 0);
CHK(g_con->execute(NoCommit) == 0); CHK(g_con->execute(NoCommit) == 0);
...@@ -1623,7 +1618,7 @@ testperf() ...@@ -1623,7 +1618,7 @@ testperf()
a = (Uint32)-1; a = (Uint32)-1;
b[0] = 0; b[0] = 0;
int ret; int ret;
CHK((ret = rs->nextResult(true)) == 0 || ret == 1); CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
if (ret == 1) if (ret == 1)
break; break;
CHK(a < g_opt.m_rowsperf && strcmp(b, "b") == 0); CHK(a < g_opt.m_rowsperf && strcmp(b, "b") == 0);
...@@ -1638,12 +1633,11 @@ testperf() ...@@ -1638,12 +1633,11 @@ testperf()
// scan read text // scan read text
{ {
DBG("--- read text ---"); DBG("--- read text ---");
NdbResultSet* rs;
Uint32 a; Uint32 a;
char c[20]; char c[20];
CHK((g_con = g_ndb->startTransaction()) != 0); CHK((g_con = g_ndb->startTransaction()) != 0);
CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0); CHK((g_ops = g_con->getNdbScanOperation(tab.getName())) != 0);
CHK((rs = g_ops->readTuples(NdbScanOperation::LM_Read)) != 0); CHK(g_ops->readTuples(NdbScanOperation::LM_Read) == 0);
CHK(g_ops->getValue(cA, (char*)&a) != 0); CHK(g_ops->getValue(cA, (char*)&a) != 0);
CHK((g_bh1 = g_ops->getBlobHandle(cC)) != 0); CHK((g_bh1 = g_ops->getBlobHandle(cC)) != 0);
CHK(g_con->execute(NoCommit) == 0); CHK(g_con->execute(NoCommit) == 0);
...@@ -1653,7 +1647,7 @@ testperf() ...@@ -1653,7 +1647,7 @@ testperf()
a = (Uint32)-1; a = (Uint32)-1;
c[0] = 0; c[0] = 0;
int ret; int ret;
CHK((ret = rs->nextResult(true)) == 0 || ret == 1); CHK((ret = g_ops->nextResult(true)) == 0 || ret == 1);
if (ret == 1) if (ret == 1)
break; break;
Uint32 m = 20; Uint32 m = 20;
......
...@@ -443,9 +443,9 @@ testcase(int flag) ...@@ -443,9 +443,9 @@ testcase(int flag)
if ((con = ndb->startTransaction()) == 0) if ((con = ndb->startTransaction()) == 0)
return ndberror("startTransaction key=%d", key); return ndberror("startTransaction key=%d", key);
if ((op = sop = con->getNdbScanOperation(tab)) == 0) if ((op = sop = con->getNdbScanOperation(tab)) == 0)
return ndberror("getNdbOperation key=%d", key); return ndberror("getNdbOperation key=%d", key);
if ((rs = sop->readTuples(1)) == 0) if (sop->readTuples(1))
return ndberror("openScanRead key=%d", key); return ndberror("openScanRead key=%d", key);
{ {
col& c = ccol[0]; col& c = ccol[0];
if (op->load_const_u32(1, key) < 0) if (op->load_const_u32(1, key) < 0)
...@@ -488,7 +488,7 @@ testcase(int flag) ...@@ -488,7 +488,7 @@ testcase(int flag)
if (con->execute(NoCommit) < 0) if (con->execute(NoCommit) < 0)
return ndberror("executeScan key=%d", key); return ndberror("executeScan key=%d", key);
int ret, cnt = 0; int ret, cnt = 0;
while ((ret = rs->nextResult()) == 0) { while ((ret = sop->nextResult()) == 0) {
if (key != newkey) if (key != newkey)
return ndberror("unexpected key=%d newkey=%d", key, newkey); return ndberror("unexpected key=%d newkey=%d", key, newkey);
for (i = 1; i < attrcnt; i++) { for (i = 1; i < attrcnt; i++) {
......
...@@ -91,7 +91,6 @@ struct Thr { ...@@ -91,7 +91,6 @@ struct Thr {
NdbConnection* m_con; NdbConnection* m_con;
NdbScanOperation* m_scanop; NdbScanOperation* m_scanop;
NdbIndexScanOperation* m_indexscanop; NdbIndexScanOperation* m_indexscanop;
NdbResultSet* m_rs;
// //
Thr(int no); Thr(int no);
~Thr(); ~Thr();
...@@ -136,7 +135,6 @@ Thr::Thr(int no) ...@@ -136,7 +135,6 @@ Thr::Thr(int no)
m_con = 0; m_con = 0;
m_scanop = 0; m_scanop = 0;
m_indexscanop = 0; m_indexscanop = 0;
m_rs = 0;
} }
Thr::~Thr() Thr::~Thr()
...@@ -374,7 +372,7 @@ wl1822_tx2_scanXY(Thr& thr) ...@@ -374,7 +372,7 @@ wl1822_tx2_scanXY(Thr& thr)
CHN(con, (scanop = thr.m_scanop = indexscanop = thr.m_indexscanop = con->getNdbIndexScanOperation(g_opt.m_xname, g_opt.m_tname)) != 0); CHN(con, (scanop = thr.m_scanop = indexscanop = thr.m_indexscanop = con->getNdbIndexScanOperation(g_opt.m_xname, g_opt.m_tname)) != 0);
DBG("tx2 scan exclusive " << g_opt.m_xname); DBG("tx2 scan exclusive " << g_opt.m_xname);
} }
CHN(scanop, (rs = thr.m_rs = scanop->readTuplesExclusive(16)) != 0); CHN(scanop, scanop->readTuplesExclusive(16) == 0);
CHN(scanop, scanop->getValue("A", (char*)&wl1822_bufA) != 0); CHN(scanop, scanop->getValue("A", (char*)&wl1822_bufA) != 0);
CHN(scanop, scanop->getValue("B", (char*)&wl1822_bufB) != 0); CHN(scanop, scanop->getValue("B", (char*)&wl1822_bufB) != 0);
CHN(con, con->execute(NoCommit) == 0); CHN(con, con->execute(NoCommit) == 0);
...@@ -383,7 +381,7 @@ wl1822_tx2_scanXY(Thr& thr) ...@@ -383,7 +381,7 @@ wl1822_tx2_scanXY(Thr& thr)
DBG("before row " << row); DBG("before row " << row);
int ret; int ret;
wl1822_bufA = wl1822_bufB = ~0; wl1822_bufA = wl1822_bufB = ~0;
CHN(con, (ret = rs->nextResult(true)) == 0); CHN(con, (ret = scanop->nextResult(true)) == 0);
DBG("got row " << row << " a=" << wl1822_bufA << " b=" << wl1822_bufB); DBG("got row " << row << " a=" << wl1822_bufA << " b=" << wl1822_bufB);
CHK(wl1822_bufA == wl1822_valA[wl1822_r2k[row]]); CHK(wl1822_bufA == wl1822_valA[wl1822_r2k[row]]);
CHK(wl1822_bufB == wl1822_valB[wl1822_r2k[row]]); CHK(wl1822_bufB == wl1822_valB[wl1822_r2k[row]]);
...@@ -419,14 +417,13 @@ wl1822_tx2_scanZ_close(Thr& thr) ...@@ -419,14 +417,13 @@ wl1822_tx2_scanZ_close(Thr& thr)
Ndb* ndb = thr.m_ndb; Ndb* ndb = thr.m_ndb;
NdbConnection* con = thr.m_con; NdbConnection* con = thr.m_con;
NdbScanOperation* scanop = thr.m_scanop; NdbScanOperation* scanop = thr.m_scanop;
NdbResultSet* rs = thr.m_rs; assert(ndb != 0 && con != 0 && scanop != 0);
assert(ndb != 0 && con != 0 && scanop != 0 && rs != 0);
unsigned row = 2; unsigned row = 2;
while (true) { while (true) {
DBG("before row " << row); DBG("before row " << row);
int ret; int ret;
wl1822_bufA = wl1822_bufB = ~0; wl1822_bufA = wl1822_bufB = ~0;
CHN(con, (ret = rs->nextResult(true)) == 0 || ret == 1); CHN(con, (ret = scanop->nextResult(true)) == 0 || ret == 1);
if (ret == 1) if (ret == 1)
break; break;
DBG("got row " << row << " a=" << wl1822_bufA << " b=" << wl1822_bufB); DBG("got row " << row << " a=" << wl1822_bufA << " b=" << wl1822_bufB);
......
...@@ -1145,20 +1145,18 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1145,20 +1145,18 @@ runUniqueNullTransactions(NDBT_Context* ctx, NDBT_Step* step){
pTrans = pNdb->startTransaction(); pTrans = pNdb->startTransaction();
NdbScanOperation * sOp; NdbScanOperation * sOp;
NdbOperation * uOp; NdbOperation * uOp;
NdbResultSet * rs;
int eof; int eof;
if(!pTrans) goto done; if(!pTrans) goto done;
sOp = pTrans->getNdbScanOperation(pTab->getName()); sOp = pTrans->getNdbScanOperation(pTab->getName());
if(!sOp) goto done; if(!sOp) goto done;
rs = sOp->readTuples(NdbScanOperation::LM_Exclusive); if(sOp->readTuples(NdbScanOperation::LM_Exclusive)) goto done;
if(!rs) goto done;
if(pTrans->execute(NoCommit) == -1) goto done; if(pTrans->execute(NoCommit) == -1) goto done;
while((eof = rs->nextResult(true)) == 0){ while((eof = sOp->nextResult(true)) == 0){
do { do {
NdbOperation * uOp = rs->updateTuple(); NdbOperation * uOp = sOp->updateCurrentTuple();
if(uOp == 0) goto done; if(uOp == 0) goto done;
uOp->setValue(colId, 0); uOp->setValue(colId, 0);
} while((eof = rs->nextResult(false)) == 0); } while((eof = sOp->nextResult(false)) == 0);
eof = pTrans->execute(Commit); eof = pTrans->execute(Commit);
if(eof == -1) goto done; if(eof == -1) goto done;
} }
......
...@@ -679,14 +679,13 @@ struct Con { ...@@ -679,14 +679,13 @@ struct Con {
NdbOperation* m_op; NdbOperation* m_op;
NdbScanOperation* m_scanop; NdbScanOperation* m_scanop;
NdbIndexScanOperation* m_indexscanop; NdbIndexScanOperation* m_indexscanop;
NdbResultSet* m_resultset;
enum ScanMode { ScanNo = 0, Committed, Latest, Exclusive }; enum ScanMode { ScanNo = 0, Committed, Latest, Exclusive };
ScanMode m_scanmode; ScanMode m_scanmode;
enum ErrType { ErrNone = 0, ErrDeadlock, ErrOther }; enum ErrType { ErrNone = 0, ErrDeadlock, ErrOther };
ErrType m_errtype; ErrType m_errtype;
Con() : Con() :
m_ndb(0), m_dic(0), m_tx(0), m_op(0), m_ndb(0), m_dic(0), m_tx(0), m_op(0),
m_scanop(0), m_indexscanop(0), m_resultset(0), m_scanmode(ScanNo), m_errtype(ErrNone) {} m_scanop(0), m_indexscanop(0), m_scanmode(ScanNo), m_errtype(ErrNone) {}
~Con() { ~Con() {
if (m_tx != 0) if (m_tx != 0)
closeTransaction(); closeTransaction();
...@@ -836,7 +835,7 @@ Con::openScanRead(unsigned scanbat, unsigned scanpar) ...@@ -836,7 +835,7 @@ Con::openScanRead(unsigned scanbat, unsigned scanpar)
{ {
assert(m_tx != 0 && m_op != 0); assert(m_tx != 0 && m_op != 0);
NdbOperation::LockMode lm = NdbOperation::LM_Read; NdbOperation::LockMode lm = NdbOperation::LM_Read;
CHKCON((m_resultset = m_scanop->readTuples(lm, scanbat, scanpar)) != 0, *this); CHKCON(m_scanop->readTuples(lm, scanbat, scanpar) == 0, *this);
return 0; return 0;
} }
...@@ -845,7 +844,7 @@ Con::openScanExclusive(unsigned scanbat, unsigned scanpar) ...@@ -845,7 +844,7 @@ Con::openScanExclusive(unsigned scanbat, unsigned scanpar)
{ {
assert(m_tx != 0 && m_op != 0); assert(m_tx != 0 && m_op != 0);
NdbOperation::LockMode lm = NdbOperation::LM_Exclusive; NdbOperation::LockMode lm = NdbOperation::LM_Exclusive;
CHKCON((m_resultset = m_scanop->readTuples(lm, scanbat, scanpar)) != 0, *this); CHKCON(m_scanop->readTuples(lm, scanbat, scanpar) == 0, *this);
return 0; return 0;
} }
...@@ -860,8 +859,8 @@ int ...@@ -860,8 +859,8 @@ int
Con::nextScanResult(bool fetchAllowed) Con::nextScanResult(bool fetchAllowed)
{ {
int ret; int ret;
assert(m_resultset != 0); assert(m_scanop != 0);
CHKCON((ret = m_resultset->nextResult(fetchAllowed)) != -1, *this); CHKCON((ret = m_scanop->nextResult(fetchAllowed)) != -1, *this);
assert(ret == 0 || ret == 1 || (! fetchAllowed && ret == 2)); assert(ret == 0 || ret == 1 || (! fetchAllowed && ret == 2));
return ret; return ret;
} }
...@@ -886,7 +885,7 @@ int ...@@ -886,7 +885,7 @@ int
Con::updateScanTuple(Con& con2) Con::updateScanTuple(Con& con2)
{ {
assert(con2.m_tx != 0); assert(con2.m_tx != 0);
CHKCON((con2.m_op = m_resultset->updateTuple(con2.m_tx)) != 0, *this); CHKCON((con2.m_op = m_scanop->updateCurrentTuple(con2.m_tx)) != 0, *this);
return 0; return 0;
} }
...@@ -894,16 +893,16 @@ int ...@@ -894,16 +893,16 @@ int
Con::deleteScanTuple(Con& con2) Con::deleteScanTuple(Con& con2)
{ {
assert(con2.m_tx != 0); assert(con2.m_tx != 0);
CHKCON(m_resultset->deleteTuple(con2.m_tx) == 0, *this); CHKCON(m_scanop->deleteCurrentTuple(con2.m_tx) == 0, *this);
return 0; return 0;
} }
void void
Con::closeScan() Con::closeScan()
{ {
assert(m_resultset != 0); assert(m_scanop != 0);
m_resultset->close(); m_scanop->close();
m_scanop = 0, m_indexscanop = 0, m_resultset = 0; m_scanop = 0, m_indexscanop = 0;
} }
...@@ -913,7 +912,7 @@ Con::closeTransaction() ...@@ -913,7 +912,7 @@ Con::closeTransaction()
assert(m_ndb != 0 && m_tx != 0); assert(m_ndb != 0 && m_tx != 0);
m_ndb->closeTransaction(m_tx); m_ndb->closeTransaction(m_tx);
m_tx = 0, m_op = 0; m_tx = 0, m_op = 0;
m_scanop = 0, m_indexscanop = 0, m_resultset = 0; m_scanop = 0, m_indexscanop = 0;
} }
void void
......
...@@ -266,7 +266,6 @@ run_read(){ ...@@ -266,7 +266,6 @@ run_read(){
NdbScanOperation * pSp; NdbScanOperation * pSp;
NdbIndexOperation * pUp; NdbIndexOperation * pUp;
NdbIndexScanOperation * pIp; NdbIndexScanOperation * pIp;
NdbResultSet * rs = (NdbResultSet*)~0;
Uint32 start_row = rand() % (rows - range); Uint32 start_row = rand() % (rows - range);
Uint32 stop_row = start_row + range; Uint32 stop_row = start_row + range;
...@@ -319,27 +318,27 @@ run_read(){ ...@@ -319,27 +318,27 @@ run_read(){
} }
break; break;
case 4: case 4:
pOp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table); pOp = pSp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table);
rs = pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0); pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0);
check = pIp->setBound(pk, NdbIndexScanOperation::BoundEQ, &start_row); check = pIp->setBound(pk, NdbIndexScanOperation::BoundEQ, &start_row);
break; break;
case 5: case 5:
pOp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table); pOp = pSp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table);
rs = pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0); pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0);
check = pIp->setBound(pk, NdbIndexScanOperation::BoundLE, &start_row); check = pIp->setBound(pk, NdbIndexScanOperation::BoundLE, &start_row);
check = pIp->setBound(pk, NdbIndexScanOperation::BoundGT, &stop_row); check = pIp->setBound(pk, NdbIndexScanOperation::BoundGT, &stop_row);
start_row = stop_row; start_row = stop_row;
break; break;
case 6: case 6:
pOp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table); pOp = pSp = pIp = pTrans->getNdbIndexScanOperation(g_ordered,g_table);
rs = pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0, true); pIp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0, true);
check = pIp->setBound(pk, NdbIndexScanOperation::BoundLE, &start_row); check = pIp->setBound(pk, NdbIndexScanOperation::BoundLE, &start_row);
check = pIp->setBound(pk, NdbIndexScanOperation::BoundGT, &stop_row); check = pIp->setBound(pk, NdbIndexScanOperation::BoundGT, &stop_row);
start_row = stop_row; start_row = stop_row;
break; break;
case 7: case 7:
pOp = pSp = pTrans->getNdbScanOperation(g_table); pOp = pSp = pTrans->getNdbScanOperation(g_table);
rs = pSp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0); pSp->readTuples(NdbScanOperation::LM_CommittedRead, 0, 0);
NdbScanFilter filter(pOp) ; NdbScanFilter filter(pOp) ;
filter.begin(NdbScanFilter::AND); filter.begin(NdbScanFilter::AND);
filter.ge(pk, start_row); filter.ge(pk, start_row);
...@@ -355,7 +354,6 @@ run_read(){ ...@@ -355,7 +354,6 @@ run_read(){
ndbout << pTrans->getNdbError() << endl; ndbout << pTrans->getNdbError() << endl;
} }
assert(check == 0); assert(check == 0);
assert(rs);
for(int j = 0; j<g_tab->getNoOfColumns(); j++){ for(int j = 0; j<g_tab->getNoOfColumns(); j++){
res = pOp->getValue(j); res = pOp->getValue(j);
...@@ -368,7 +366,7 @@ run_read(){ ...@@ -368,7 +366,7 @@ run_read(){
} }
assert(check == 0); assert(check == 0);
if(g_paramters[P_OPER].value >= 4){ if(g_paramters[P_OPER].value >= 4){
while((check = rs->nextResult(true)) == 0){ while((check = pSp->nextResult(true)) == 0){
cnt++; cnt++;
} }
...@@ -377,13 +375,13 @@ run_read(){ ...@@ -377,13 +375,13 @@ run_read(){
return -1; return -1;
} }
assert(check == 1); assert(check == 1);
rs->close(); pSp->close();
} }
} }
assert(g_paramters[P_OPER].value < 4 || (cnt == range)); assert(g_paramters[P_OPER].value < 4 || (cnt == range));
pTrans->close(); pTrans->close();
stop = NdbTick_CurrentMillisecond(); stop = NdbTick_CurrentMillisecond();
g_times[g_paramters[P_OPER].value] += (stop - start1); g_times[g_paramters[P_OPER].value] += (stop - start1);
return 0; return 0;
......
...@@ -999,8 +999,7 @@ int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -999,8 +999,7 @@ int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet* rs = pOp->readTuples(); if( pOp->readTuples() ) {
if( rs == 0 ) {
ERR(pCon->getNdbError()); ERR(pCon->getNdbError());
return NDBT_FAILED; return NDBT_FAILED;
} }
...@@ -1028,7 +1027,7 @@ int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1028,7 +1027,7 @@ int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){
int res; int res;
int row = 0; int row = 0;
while(row < record && (res = rs->nextResult()) == 0) { while(row < record && (res = pOp->nextResult()) == 0) {
if(calc.verifyRowValues(&tmpRow) != 0){ if(calc.verifyRowValues(&tmpRow) != 0){
abort(); abort();
return NDBT_FAILED; return NDBT_FAILED;
...@@ -1041,14 +1040,14 @@ int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -1041,14 +1040,14 @@ int runScanRestart(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_FAILED; return NDBT_FAILED;
} }
g_info << " restarting" << endl; g_info << " restarting" << endl;
if((res = rs->restart()) != 0){ if((res = pOp->restart()) != 0){
ERR(pCon->getNdbError()); ERR(pCon->getNdbError());
abort(); abort();
return NDBT_FAILED; return NDBT_FAILED;
} }
row = 0; row = 0;
while((res = rs->nextResult()) == 0) { while((res = pOp->nextResult()) == 0) {
if(calc.verifyRowValues(&tmpRow) != 0){ if(calc.verifyRowValues(&tmpRow) != 0){
abort(); abort();
return NDBT_FAILED; return NDBT_FAILED;
......
...@@ -198,7 +198,6 @@ run_scan(){ ...@@ -198,7 +198,6 @@ run_scan(){
NdbScanOperation * pOp = 0; NdbScanOperation * pOp = 0;
NdbIndexScanOperation * pIOp = 0; NdbIndexScanOperation * pIOp = 0;
NdbConnection * pTrans = 0; NdbConnection * pTrans = 0;
NdbResultSet * rs = 0;
int check = 0; int check = 0;
for(int i = 0; i<iter; i++){ for(int i = 0; i<iter; i++){
...@@ -230,13 +229,13 @@ run_scan(){ ...@@ -230,13 +229,13 @@ run_scan(){
if(g_paramters[P_ACCESS].value == 0){ if(g_paramters[P_ACCESS].value == 0){
pOp = pTrans->getNdbScanOperation(g_tablename); pOp = pTrans->getNdbScanOperation(g_tablename);
assert(pOp); assert(pOp);
rs = pOp->readTuples(lm, bat, par); pOp->readTuples(lm, bat, par);
} else { } else {
if(g_paramters[P_RESET].value == 0 || pIOp == 0) if(g_paramters[P_RESET].value == 0 || pIOp == 0)
{ {
pOp= pIOp= pTrans->getNdbIndexScanOperation(g_indexname, g_tablename); pOp= pIOp= pTrans->getNdbIndexScanOperation(g_indexname, g_tablename);
bool ord = g_paramters[P_ACCESS].value == 2; bool ord = g_paramters[P_ACCESS].value == 2;
rs = pIOp->readTuples(lm, bat, par, ord); pIOp->readTuples(lm, bat, par, ord);
} }
else else
{ {
...@@ -270,7 +269,7 @@ run_scan(){ ...@@ -270,7 +269,7 @@ run_scan(){
{ {
int row = rand() % tot; int row = rand() % tot;
pIOp->setBound((Uint32)0, NdbIndexScanOperation::BoundEQ, &row); pIOp->setBound((Uint32)0, NdbIndexScanOperation::BoundEQ, &row);
pIOp->end_of_bound(); pIOp->end_of_bound(i);
} }
if(g_paramters[P_RESET].value == 2) if(g_paramters[P_RESET].value == 2)
goto execute; goto execute;
...@@ -279,7 +278,6 @@ run_scan(){ ...@@ -279,7 +278,6 @@ run_scan(){
} }
} }
assert(pOp); assert(pOp);
assert(rs);
switch(g_paramters[P_FILT].value){ switch(g_paramters[P_FILT].value){
case 0: // All case 0: // All
...@@ -323,10 +321,10 @@ execute: ...@@ -323,10 +321,10 @@ execute:
check = pTrans->execute(NoCommit); check = pTrans->execute(NoCommit);
assert(check == 0); assert(check == 0);
int fetch = g_paramters[P_FETCH].value; int fetch = g_paramters[P_FETCH].value;
while((check = rs->nextResult(true)) == 0){ while((check = pOp->nextResult(true)) == 0){
do { do {
rows++; rows++;
} while(!fetch && ((check = rs->nextResult(false)) == 0)); } while(!fetch && ((check = pOp->nextResult(false)) == 0));
if(check == -1){ if(check == -1){
err(pTrans->getNdbError()); err(pTrans->getNdbError());
return -1; return -1;
......
...@@ -305,7 +305,7 @@ int HugoOperations::execute_Commit(Ndb* pNdb, ...@@ -305,7 +305,7 @@ int HugoOperations::execute_Commit(Ndb* pNdb,
m_executed_result_sets.push_back(m_result_sets[i]); m_executed_result_sets.push_back(m_result_sets[i]);
int rows = m_result_sets[i].records; int rows = m_result_sets[i].records;
NdbResultSet* rs = m_result_sets[i].m_result_set; NdbScanOperation* rs = m_result_sets[i].m_result_set;
int res = rs->nextResult(); int res = rs->nextResult();
switch(res){ switch(res){
case 1: case 1:
...@@ -354,7 +354,7 @@ int HugoOperations::execute_NoCommit(Ndb* pNdb, AbortOption eao){ ...@@ -354,7 +354,7 @@ int HugoOperations::execute_NoCommit(Ndb* pNdb, AbortOption eao){
m_executed_result_sets.push_back(m_result_sets[i]); m_executed_result_sets.push_back(m_result_sets[i]);
int rows = m_result_sets[i].records; int rows = m_result_sets[i].records;
NdbResultSet* rs = m_result_sets[i].m_result_set; NdbScanOperation* rs = m_result_sets[i].m_result_set;
int res = rs->nextResult(); int res = rs->nextResult();
switch(res){ switch(res){
case 1: case 1:
...@@ -700,12 +700,10 @@ HugoOperations::scanReadRecords(Ndb* pNdb, NdbScanOperation::LockMode lm, ...@@ -700,12 +700,10 @@ HugoOperations::scanReadRecords(Ndb* pNdb, NdbScanOperation::LockMode lm,
if(!pOp) if(!pOp)
return -1; return -1;
NdbResultSet * rs = pOp->readTuples(lm, 1, 1); if(pOp->readTuples(lm, 1, 1)){
if(!rs){
return -1; return -1;
} }
for(int a = 0; a<tab.getNoOfColumns(); a++){ for(int a = 0; a<tab.getNoOfColumns(); a++){
if((rows[0]->attributeStore(a) = if((rows[0]->attributeStore(a) =
pOp->getValue(tab.getColumn(a)->getName())) == 0) { pOp->getValue(tab.getColumn(a)->getName())) == 0) {
...@@ -713,8 +711,8 @@ HugoOperations::scanReadRecords(Ndb* pNdb, NdbScanOperation::LockMode lm, ...@@ -713,8 +711,8 @@ HugoOperations::scanReadRecords(Ndb* pNdb, NdbScanOperation::LockMode lm,
return NDBT_FAILED; return NDBT_FAILED;
} }
} }
RsPair p = {rs, records}; RsPair p = {pOp, records};
m_result_sets.push_back(p); m_result_sets.push_back(p);
return 0; return 0;
......
...@@ -72,10 +72,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, ...@@ -72,10 +72,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs; if( pOp ->readTuples(lm) ) {
rs = pOp ->readTuples(lm);
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -124,7 +121,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, ...@@ -124,7 +121,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
int eof; int eof;
int rows = 0; int rows = 0;
while((eof = rs->nextResult(true)) == 0){ while((eof = pOp->nextResult(true)) == 0){
rows++; rows++;
if (calc.verifyRowValues(&row) != 0){ if (calc.verifyRowValues(&row) != 0){
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
...@@ -134,7 +131,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, ...@@ -134,7 +131,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
if (abortCount == rows && abortTrans == true){ if (abortCount == rows && abortTrans == true){
ndbout << "Scan is aborted" << endl; ndbout << "Scan is aborted" << endl;
g_info << "Scan is aborted" << endl; g_info << "Scan is aborted" << endl;
rs->close(); pOp->close();
if( check == -1 ) { if( check == -1 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
...@@ -228,10 +225,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, ...@@ -228,10 +225,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs; if( pOp ->readTuples(lm, 0, parallelism, sorted) ) {
rs = pOp ->readTuples(lm, 0, parallelism, sorted);
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -280,7 +274,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, ...@@ -280,7 +274,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
int eof; int eof;
int rows = 0; int rows = 0;
while((eof = rs->nextResult(true)) == 0){ while((eof = pOp->nextResult(true)) == 0){
rows++; rows++;
if (calc.verifyRowValues(&row) != 0){ if (calc.verifyRowValues(&row) != 0){
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
...@@ -290,7 +284,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb, ...@@ -290,7 +284,7 @@ HugoTransactions::scanReadRecords(Ndb* pNdb,
if (abortCount == rows && abortTrans == true){ if (abortCount == rows && abortTrans == true){
ndbout << "Scan is aborted" << endl; ndbout << "Scan is aborted" << endl;
g_info << "Scan is aborted" << endl; g_info << "Scan is aborted" << endl;
rs->close(); pOp->close();
if( check == -1 ) { if( check == -1 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
...@@ -732,8 +726,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, ...@@ -732,8 +726,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet *rs = pOp->readTuplesExclusive(parallelism); if( pOp->readTuplesExclusive(parallelism) ) {
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -771,10 +764,10 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, ...@@ -771,10 +764,10 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
} }
int rows = 0; int rows = 0;
while((check = rs->nextResult(true)) == 0){ while((check = pOp->nextResult(true)) == 0){
do { do {
rows++; rows++;
NdbOperation* pUp = rs->updateTuple(); NdbOperation* pUp = pOp->updateCurrentTuple();
if(pUp == 0){ if(pUp == 0){
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
...@@ -798,7 +791,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb, ...@@ -798,7 +791,7 @@ HugoTransactions::scanUpdateRecords3(Ndb* pNdb,
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_OK; return NDBT_OK;
} }
} while((check = rs->nextResult(false)) == 0); } while((check = pOp->nextResult(false)) == 0);
if(check != -1){ if(check != -1){
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
...@@ -2133,7 +2126,6 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, ...@@ -2133,7 +2126,6 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
NdbConnection *pTrans; NdbConnection *pTrans;
NdbOperation *pOp; NdbOperation *pOp;
NdbIndexScanOperation *sOp; NdbIndexScanOperation *sOp;
NdbResultSet * rs;
const NdbDictionary::Index* pIndex const NdbDictionary::Index* pIndex
= pNdb->getDictionary()->getIndex(idxName, tab.getName()); = pNdb->getDictionary()->getIndex(idxName, tab.getName());
...@@ -2189,9 +2181,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, ...@@ -2189,9 +2181,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
} }
check = 0; check = 0;
rs = sOp->readTuples();
} }
if( check == -1 ) { if( check == -1 ) {
...@@ -2223,7 +2213,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, ...@@ -2223,7 +2213,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
} }
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
check = (check == -1 ? -1 : !ordered ? check : rs->nextResult(true)); check = (check == -1 ? -1 : !ordered ? check : sOp->nextResult(true));
if( check == -1 ) { if( check == -1 ) {
const NdbError err = pTrans->getNdbError(); const NdbError err = pTrans->getNdbError();
...@@ -2254,7 +2244,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb, ...@@ -2254,7 +2244,7 @@ HugoTransactions::indexReadRecords(Ndb* pNdb,
reads++; reads++;
r++; r++;
} }
if(ordered && rs->nextResult(true) == 0){ if(ordered && sOp->nextResult(true) == 0){
ndbout << "Error when comparing records " ndbout << "Error when comparing records "
<< " - index op next_result to many" << endl; << " - index op next_result to many" << endl;
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
...@@ -2284,7 +2274,6 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, ...@@ -2284,7 +2274,6 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
NdbConnection *pTrans; NdbConnection *pTrans;
NdbOperation *pOp; NdbOperation *pOp;
NdbScanOperation * sOp; NdbScanOperation * sOp;
NdbResultSet * rs;
const NdbDictionary::Index* pIndex const NdbDictionary::Index* pIndex
= pNdb->getDictionary()->getIndex(idxName, tab.getName()); = pNdb->getDictionary()->getIndex(idxName, tab.getName());
...@@ -2341,7 +2330,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, ...@@ -2341,7 +2330,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
} }
check = 0; check = 0;
rs = sOp->readTuplesExclusive(); sOp->readTuplesExclusive();
} }
// Define primary keys // Define primary keys
...@@ -2367,7 +2356,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, ...@@ -2367,7 +2356,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
} }
check = pTrans->execute(NoCommit); check = pTrans->execute(NoCommit);
check = (check == -1 ? -1 : !ordered ? check : rs->nextResult(true)); check = (check == -1 ? -1 : !ordered ? check : sOp->nextResult(true));
if( check == -1 ) { if( check == -1 ) {
const NdbError err = pTrans->getNdbError(); const NdbError err = pTrans->getNdbError();
ERR(err); ERR(err);
...@@ -2400,7 +2389,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb, ...@@ -2400,7 +2389,7 @@ HugoTransactions::indexUpdateRecords(Ndb* pNdb,
pUpdOp = pTrans->getNdbIndexOperation(idxName, tab.getName()); pUpdOp = pTrans->getNdbIndexOperation(idxName, tab.getName());
check = (pUpdOp == 0 ? -1 : pUpdOp->updateTuple()); check = (pUpdOp == 0 ? -1 : pUpdOp->updateTuple());
} else { } else {
pUpdOp = rs->updateTuple(); pUpdOp = sOp->updateCurrentTuple();
} }
if (pUpdOp == NULL) { if (pUpdOp == NULL) {
......
...@@ -394,8 +394,7 @@ UtilTransactions::clearTable3(Ndb* pNdb, ...@@ -394,8 +394,7 @@ UtilTransactions::clearTable3(Ndb* pNdb,
goto failed; goto failed;
} }
NdbResultSet * rs = pOp->readTuplesExclusive(par); if( pOp->readTuplesExclusive(par) ) {
if( rs == 0 ) {
err = pTrans->getNdbError(); err = pTrans->getNdbError();
goto failed; goto failed;
} }
...@@ -411,13 +410,13 @@ UtilTransactions::clearTable3(Ndb* pNdb, ...@@ -411,13 +410,13 @@ UtilTransactions::clearTable3(Ndb* pNdb,
goto failed; goto failed;
} }
while((check = rs->nextResult(true)) == 0){ while((check = pOp->nextResult(true)) == 0){
do { do {
if (rs->deleteTuple() != 0){ if (pOp->deleteCurrentTuple() != 0){
goto failed; goto failed;
} }
deletedRows++; deletedRows++;
} while((check = rs->nextResult(false)) == 0); } while((check = pOp->nextResult(false)) == 0);
if(check != -1){ if(check != -1){
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
...@@ -502,9 +501,7 @@ UtilTransactions::copyTableData(Ndb* pNdb, ...@@ -502,9 +501,7 @@ UtilTransactions::copyTableData(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet* rs = pOp->readTuples(NdbScanOperation::LM_Read, if( pOp->readTuples(NdbScanOperation::LM_Read, parallelism) ) {
parallelism);
if( check == -1 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -535,14 +532,14 @@ UtilTransactions::copyTableData(Ndb* pNdb, ...@@ -535,14 +532,14 @@ UtilTransactions::copyTableData(Ndb* pNdb,
} }
int eof; int eof;
while((eof = rs->nextResult(true)) == 0){ while((eof = pOp->nextResult(true)) == 0){
do { do {
insertedRows++; insertedRows++;
if (addRowToInsert(pNdb, pTrans, row, destName) != 0){ if (addRowToInsert(pNdb, pTrans, row, destName) != 0){
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
} }
} while((eof = rs->nextResult(false)) == 0); } while((eof = pOp->nextResult(false)) == 0);
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
pTrans->restart(); pTrans->restart();
...@@ -669,8 +666,7 @@ UtilTransactions::scanReadRecords(Ndb* pNdb, ...@@ -669,8 +666,7 @@ UtilTransactions::scanReadRecords(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(lm, 0, parallelism); if( pOp->readTuples(lm, 0, parallelism) ) {
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -718,7 +714,7 @@ UtilTransactions::scanReadRecords(Ndb* pNdb, ...@@ -718,7 +714,7 @@ UtilTransactions::scanReadRecords(Ndb* pNdb,
int rows = 0; int rows = 0;
while((eof = rs->nextResult()) == 0){ while((eof = pOp->nextResult()) == 0){
rows++; rows++;
// Call callback for each record returned // Call callback for each record returned
...@@ -782,8 +778,7 @@ UtilTransactions::selectCount(Ndb* pNdb, ...@@ -782,8 +778,7 @@ UtilTransactions::selectCount(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(lm); if( pOp->readTuples(lm) ) {
if( rs == 0) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -815,7 +810,7 @@ UtilTransactions::selectCount(Ndb* pNdb, ...@@ -815,7 +810,7 @@ UtilTransactions::selectCount(Ndb* pNdb,
int rows = 0; int rows = 0;
while((eof = rs->nextResult()) == 0){ while((eof = pOp->nextResult()) == 0){
rows++; rows++;
} }
if (eof == -1) { if (eof == -1) {
...@@ -948,14 +943,14 @@ UtilTransactions::scanAndCompareUniqueIndex(Ndb* pNdb, ...@@ -948,14 +943,14 @@ UtilTransactions::scanAndCompareUniqueIndex(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet* rs; int rs;
if(transactional){ if(transactional){
rs = pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism); rs = pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism);
} else { } else {
rs = pOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, parallelism); rs = pOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, parallelism);
} }
if( rs == 0 ) { if( rs != 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -998,7 +993,7 @@ UtilTransactions::scanAndCompareUniqueIndex(Ndb* pNdb, ...@@ -998,7 +993,7 @@ UtilTransactions::scanAndCompareUniqueIndex(Ndb* pNdb,
int rows = 0; int rows = 0;
while((eof = rs->nextResult()) == 0){ while((eof = pOp->nextResult()) == 0){
rows++; rows++;
// ndbout << row.c_str().c_str() << endl; // ndbout << row.c_str().c_str() << endl;
...@@ -1046,7 +1041,6 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1046,7 +1041,6 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
const int retryMax = 100; const int retryMax = 100;
int check, a; int check, a;
NdbConnection *pTrans1=NULL; NdbConnection *pTrans1=NULL;
NdbResultSet *cursor= NULL;
NdbOperation *pOp; NdbOperation *pOp;
int return_code= NDBT_FAILED; int return_code= NDBT_FAILED;
...@@ -1174,7 +1168,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1174,7 +1168,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
if (pIndexOp) { if (pIndexOp) {
not_ok = pIndexOp->readTuple() == -1; not_ok = pIndexOp->readTuple() == -1;
} else { } else {
not_ok = (cursor= pScanOp->readTuples()) == 0; not_ok = pScanOp->readTuples();
} }
if( not_ok ) { if( not_ok ) {
...@@ -1251,7 +1245,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1251,7 +1245,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
*/ */
if(!null_found){ if(!null_found){
if (pScanOp) { if (pScanOp) {
if (cursor->nextResult() != 0){ if (pScanOp->nextResult() != 0){
const NdbError err = pTrans1->getNdbError(); const NdbError err = pTrans1->getNdbError();
ERR(err); ERR(err);
ndbout << "Error when comparing records - index op next_result missing" << endl; ndbout << "Error when comparing records - index op next_result missing" << endl;
...@@ -1266,7 +1260,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1266,7 +1260,7 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
goto close_all; goto close_all;
} }
if (pScanOp) { if (pScanOp) {
if (cursor->nextResult() == 0){ if (pScanOp->nextResult() == 0){
ndbout << "Error when comparing records - index op next_result to many" << endl; ndbout << "Error when comparing records - index op next_result to many" << endl;
ndbout << "row: " << row.c_str().c_str() << endl; ndbout << "row: " << row.c_str().c_str() << endl;
goto close_all; goto close_all;
...@@ -1278,8 +1272,6 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb, ...@@ -1278,8 +1272,6 @@ UtilTransactions::readRowFromTableAndIndex(Ndb* pNdb,
} }
close_all: close_all:
if (cursor)
cursor->close();
if (pTrans1) if (pTrans1)
pNdb->closeTransaction(pTrans1); pNdb->closeTransaction(pTrans1);
...@@ -1298,7 +1290,6 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb, ...@@ -1298,7 +1290,6 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
NdbConnection *pTrans; NdbConnection *pTrans;
NdbScanOperation *pOp; NdbScanOperation *pOp;
NdbIndexScanOperation * iop = 0; NdbIndexScanOperation * iop = 0;
NdbResultSet* cursor= 0;
NDBT_ResultRow scanRow(tab); NDBT_ResultRow scanRow(tab);
NDBT_ResultRow pkRow(tab); NDBT_ResultRow pkRow(tab);
...@@ -1337,10 +1328,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb, ...@@ -1337,10 +1328,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet* if( pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism) ) {
rs = pOp->readTuples(NdbScanOperation::LM_Read, 0, parallelism);
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -1376,7 +1364,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb, ...@@ -1376,7 +1364,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
int eof; int eof;
int rows = 0; int rows = 0;
while(check == 0 && (eof = rs->nextResult()) == 0){ while(check == 0 && (eof = pOp->nextResult()) == 0){
rows++; rows++;
bool null_found= false; bool null_found= false;
...@@ -1401,10 +1389,11 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb, ...@@ -1401,10 +1389,11 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
if(!iop && (iop= pTrans->getNdbIndexScanOperation(indexName, if(!iop && (iop= pTrans->getNdbIndexScanOperation(indexName,
tab.getName()))) tab.getName())))
{ {
cursor= iop->readTuples(NdbScanOperation::LM_CommittedRead, if(iop->readTuples(NdbScanOperation::LM_CommittedRead,
parallelism); parallelism))
goto error;
iop->interpret_exit_ok(); iop->interpret_exit_ok();
if(!cursor || get_values(iop, indexRow)) if(get_values(iop, indexRow))
goto error; goto error;
} }
else if(!iop || iop->reset_bounds()) else if(!iop || iop->reset_bounds())
...@@ -1431,7 +1420,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb, ...@@ -1431,7 +1420,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
if(!null_found) if(!null_found)
{ {
if((res= cursor->nextResult()) != 0){ if((res= iop->nextResult()) != 0){
g_err << "Failed to find row using index: " << res << endl; g_err << "Failed to find row using index: " << res << endl;
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
...@@ -1446,7 +1435,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb, ...@@ -1446,7 +1435,7 @@ UtilTransactions::verifyOrderedIndex(Ndb* pNdb,
return NDBT_FAILED; return NDBT_FAILED;
} }
if(cursor->nextResult() == 0){ if(iop->nextResult() == 0){
g_err << "Found extra row!!" << endl; g_err << "Found extra row!!" << endl;
g_err << " indexRow: \n" << indexRow.c_str().c_str() << endl; g_err << " indexRow: \n" << indexRow.c_str().c_str() << endl;
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
......
...@@ -141,8 +141,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism) ...@@ -141,8 +141,7 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
goto failed; goto failed;
} }
NdbResultSet * rs = pOp->readTuplesExclusive(par); if( pOp->readTuplesExclusive(par) ) {
if( rs == 0 ) {
goto failed; goto failed;
} }
...@@ -157,13 +156,13 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism) ...@@ -157,13 +156,13 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
goto failed; goto failed;
} }
while((check = rs->nextResult(true)) == 0){ while((check = pOp->nextResult(true)) == 0){
do { do {
if (rs->deleteTuple() != 0){ if (pOp->deleteCurrentTuple() != 0){
goto failed; goto failed;
} }
deletedRows++; deletedRows++;
} while((check = rs->nextResult(false)) == 0); } while((check = pOp->nextResult(false)) == 0);
if(check != -1){ if(check != -1){
check = pTrans->execute(Commit); check = pTrans->execute(Commit);
......
...@@ -215,7 +215,7 @@ int scanReadRecords(Ndb* pNdb, ...@@ -215,7 +215,7 @@ int scanReadRecords(Ndb* pNdb,
return -1; return -1;
} }
NdbResultSet * rs; int rs;
switch(_lock + (3 * order)){ switch(_lock + (3 * order)){
case 1: case 1:
rs = pOp->readTuples(NdbScanOperation::LM_Read, 0, parallel); rs = pOp->readTuples(NdbScanOperation::LM_Read, 0, parallel);
...@@ -238,7 +238,7 @@ int scanReadRecords(Ndb* pNdb, ...@@ -238,7 +238,7 @@ int scanReadRecords(Ndb* pNdb,
rs = pOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, parallel); rs = pOp->readTuples(NdbScanOperation::LM_CommittedRead, 0, parallel);
break; break;
} }
if( rs == 0 ){ if( rs != 0 ){
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return -1; return -1;
...@@ -324,7 +324,7 @@ int scanReadRecords(Ndb* pNdb, ...@@ -324,7 +324,7 @@ int scanReadRecords(Ndb* pNdb,
int eof; int eof;
int rows = 0; int rows = 0;
eof = rs->nextResult(); eof = pOp->nextResult();
while(eof == 0){ while(eof == 0){
rows++; rows++;
...@@ -335,7 +335,7 @@ int scanReadRecords(Ndb* pNdb, ...@@ -335,7 +335,7 @@ int scanReadRecords(Ndb* pNdb,
ndbout << (*row) << endl; ndbout << (*row) << endl;
} }
eof = rs->nextResult(); eof = pOp->nextResult();
} }
if (eof == -1) { if (eof == -1) {
const NdbError err = pTrans->getNdbError(); const NdbError err = pTrans->getNdbError();
......
...@@ -164,8 +164,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, ...@@ -164,8 +164,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
return NDBT_FAILED; return NDBT_FAILED;
} }
NdbResultSet * rs = pOp->readTuples(NdbScanOperation::LM_Dirty); if( pOp->readTuples(NdbScanOperation::LM_Dirty) ) {
if( rs == 0 ) {
ERR(pTrans->getNdbError()); ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans); pNdb->closeTransaction(pTrans);
return NDBT_FAILED; return NDBT_FAILED;
...@@ -191,7 +190,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, ...@@ -191,7 +190,7 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
Uint64 row_count = 0; Uint64 row_count = 0;
int eof; int eof;
while((eof = rs->nextResult(true)) == 0){ while((eof = pOp->nextResult(true)) == 0){
row_count += tmp; row_count += tmp;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment