summaryrefslogtreecommitdiff
path: root/ndb/test/src/HugoOperations.cpp
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-12-14 22:30:33 +0100
committerunknown <joreland@mysql.com>2004-12-14 22:30:33 +0100
commit3f89a4f362b2592b496b38fab4607d5f3dc0baa7 (patch)
tree9ef247dbbb5856ce80240a0d399cca0ac4851986 /ndb/test/src/HugoOperations.cpp
parent253dab847d3c75f2904d00331ce7e1a199827e90 (diff)
downloadmariadb-git-3f89a4f362b2592b496b38fab4607d5f3dc0baa7.tar.gz
ndb - major update HugoOperations/Transactions
+more code reuse +easier testing of indexes ndb/include/ndbapi/NdbDictionary.hpp: Remove unimplemented enums ndb/test/include/HugoOperations.hpp: Pass index on constructor ndb/test/include/HugoTransactions.hpp: Pass index on constructor ndb/test/include/UtilTransactions.hpp: Pass index on constructor ndb/test/src/HugoAsynchTransactions.cpp: Pass index on constructor ndb/test/src/HugoOperations.cpp: Use getOperation to select operation type ndb/test/src/HugoTransactions.cpp: Use HugoOpertaions to run transactions ndb/test/src/UtilTransactions.cpp: Use HugoOpertaions to run transactions
Diffstat (limited to 'ndb/test/src/HugoOperations.cpp')
-rw-r--r--ndb/test/src/HugoOperations.cpp83
1 files changed, 12 insertions, 71 deletions
diff --git a/ndb/test/src/HugoOperations.cpp b/ndb/test/src/HugoOperations.cpp
index 3cf4d618833..0a14e67259c 100644
--- a/ndb/test/src/HugoOperations.cpp
+++ b/ndb/test/src/HugoOperations.cpp
@@ -57,8 +57,10 @@ int HugoOperations::pkReadRecord(Ndb* pNdb,
int a;
allocRows(numRecords);
int check;
+
for(int r=0; r < numRecords; r++){
- NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
+
+ NdbOperation* pOp = getOperation(pTrans, NdbOperation::ReadRequest);
if (pOp == NULL) {
ERR(pTrans->getNdbError());
return NDBT_FAILED;
@@ -115,7 +117,7 @@ int HugoOperations::pkUpdateRecord(Ndb* pNdb,
allocRows(numRecords);
int check;
for(int r=0; r < numRecords; r++){
- NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
+ NdbOperation* pOp = getOperation(pTrans, NdbOperation::UpdateRequest);
if (pOp == NULL) {
ERR(pTrans->getNdbError());
return NDBT_FAILED;
@@ -157,7 +159,7 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb,
int a, check;
for(int r=0; r < numRecords; r++){
- NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
+ NdbOperation* pOp = getOperation(pTrans, NdbOperation::InsertRequest);
if (pOp == NULL) {
ERR(pTrans->getNdbError());
return NDBT_FAILED;
@@ -198,7 +200,7 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb,
int a, check;
for(int r=0; r < numRecords; r++){
- NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
+ NdbOperation* pOp = getOperation(pTrans, NdbOperation::DeleteRequest);
if (pOp == NULL) {
ERR(pTrans->getNdbError());
return NDBT_FAILED;
@@ -222,65 +224,6 @@ int HugoOperations::pkDeleteRecord(Ndb* pNdb,
}
return NDBT_OK;
}
-#if 0
-NdbResultSet*
-HugoOperations::scanReadRecords(Ndb* pNdb, ScanLock lock){
-
- NDBT_ResultRow * m_tmpRow = new NDBT_ResultRow(tab);
-
- NdbScanOperation* pOp = pTrans->getNdbScanOperation(tab.getName());
- if (pOp == NULL) {
- ERR(pTrans->getNdbError());
- return 0;
- }
-
-
- int check = 0;
- NdbResultSet * rs = 0;
- switch(lock){
- case SL_ReadHold:
- rs = pOp->readTuples(NdbScanOperation::LM_Read, 1, 1);
- break;
- case SL_Exclusive:
- rs = pOp->readTuples(NdbScanOperation::LM_Exclusive, 1, 1);
- break;
- case SL_Read:
- default:
- rs = pOp->readTuples(NdbScanOperation::LM_Dirty, 1, 1);
- }
-
- if( rs == 0) {
- ERR(pTrans->getNdbError());
- return 0;
- }
-
- check = pOp->interpret_exit_ok();
- if( check == -1 ) {
- ERR(pTrans->getNdbError());
- return 0;
- }
-
- // Define attributes to read
- for(int a = 0; a<tab.getNoOfColumns(); a++){
- if((m_tmpRow->attributeStore(a) =
- pOp->getValue(tab.getColumn(a)->getName())) == 0) {
- ERR(pTrans->getNdbError());
- return 0;
- }
- }
- return rs;
-}
-
-int
-HugoOperations::readTuples(NdbResultSet* rs){
- int res = 0;
- while((res = rs->nextResult()) == 0){
- }
- if(res != 1)
- return NDBT_FAILED;
- return NDBT_OK;
-}
-#endif
int HugoOperations::execute_Commit(Ndb* pNdb,
AbortOption eao){
@@ -392,11 +335,11 @@ int HugoOperations::execute_Rollback(Ndb* pNdb){
return NDBT_OK;
}
-HugoOperations::HugoOperations(const NdbDictionary::Table& _tab):
- UtilTransactions(_tab),
- calc(_tab),
- pTrans(NULL){
-
+HugoOperations::HugoOperations(const NdbDictionary::Table& _tab,
+ const NdbDictionary::Index* idx):
+ UtilTransactions(_tab, idx),
+ calc(_tab)
+{
}
HugoOperations::~HugoOperations(){
@@ -531,14 +474,12 @@ HugoOperations::verifyUpdatesValue(int updatesValue, int _numRows){
}
void HugoOperations::allocRows(int _numRows){
- deallocRows();
-
if(_numRows <= 0){
g_info << "Illegal value for num rows : " << _numRows << endl;
abort();
}
- for(int b=0; b<_numRows; b++){
+ for(int b=rows.size(); b<_numRows; b++){
rows.push_back(new NDBT_ResultRow(tab));
}
}