summaryrefslogtreecommitdiff
path: root/ndb/test/src/HugoOperations.cpp
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2005-07-20 14:25:46 +0200
committerunknown <joreland@mysql.com>2005-07-20 14:25:46 +0200
commit46c627f34c77f7e103d7afa2fc54451c1ff9d28a (patch)
tree84ee386073b270372be1ac5bcbaffe380d94f906 /ndb/test/src/HugoOperations.cpp
parent21038e65daf34d2348706775b6f45e91268969f8 (diff)
parent5aac38c084590e894f2e82b4cdef349dcc14e3f1 (diff)
downloadmariadb-git-46c627f34c77f7e103d7afa2fc54451c1ff9d28a.tar.gz
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/jonas/src/mysql-4.1-push
Diffstat (limited to 'ndb/test/src/HugoOperations.cpp')
-rw-r--r--ndb/test/src/HugoOperations.cpp91
1 files changed, 87 insertions, 4 deletions
diff --git a/ndb/test/src/HugoOperations.cpp b/ndb/test/src/HugoOperations.cpp
index 8e6603ec6ff..6b1a1ca395b 100644
--- a/ndb/test/src/HugoOperations.cpp
+++ b/ndb/test/src/HugoOperations.cpp
@@ -16,7 +16,6 @@
#include <HugoOperations.hpp>
-
int HugoOperations::startTransaction(Ndb* pNdb){
if (pTrans != NULL){
@@ -199,6 +198,48 @@ int HugoOperations::pkInsertRecord(Ndb* pNdb,
return NDBT_OK;
}
+int HugoOperations::pkWriteRecord(Ndb* pNdb,
+ int recordNo,
+ int numRecords,
+ int updatesValue){
+
+ int a, check;
+ for(int r=0; r < numRecords; r++){
+ NdbOperation* pOp = pTrans->getNdbOperation(tab.getName());
+ if (pOp == NULL) {
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ check = pOp->writeTuple();
+ if( check == -1 ) {
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ // Define primary keys
+ for(a = 0; a<tab.getNoOfColumns(); a++){
+ if (tab.getColumn(a)->getPrimaryKey() == true){
+ if(equalForAttr(pOp, a, r+recordNo) != 0){
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ // Define attributes to update
+ for(a = 0; a<tab.getNoOfColumns(); a++){
+ if (tab.getColumn(a)->getPrimaryKey() == false){
+ if(setValueForAttr(pOp, a, recordNo+r, updatesValue ) != 0){
+ ERR(pTrans->getNdbError());
+ return NDBT_FAILED;
+ }
+ }
+ }
+ }
+ return NDBT_OK;
+}
+
int HugoOperations::pkDeleteRecord(Ndb* pNdb,
int recordNo,
int numRecords){
@@ -399,16 +440,58 @@ int HugoOperations::execute_Rollback(Ndb* pNdb){
return NDBT_OK;
}
+void
+HugoOperations_async_callback(int res, NdbConnection* pCon, void* ho)
+{
+ ((HugoOperations*)ho)->callback(res, pCon);
+}
+
+void
+HugoOperations::callback(int res, NdbConnection* pCon)
+{
+ assert(pCon == pTrans);
+ m_async_reply= 1;
+ m_async_return= res;
+}
+
+int
+HugoOperations::execute_async(Ndb* pNdb, ExecType et, AbortOption eao){
+
+ m_async_reply= 0;
+ pTrans->executeAsynchPrepare(et,
+ HugoOperations_async_callback,
+ this,
+ eao);
+
+ pNdb->sendPreparedTransactions();
+
+ return NDBT_OK;
+}
+
+int
+HugoOperations::wait_async(Ndb* pNdb, int timeout)
+{
+ pNdb->pollNdb(1000);
+
+ if(m_async_reply)
+ {
+ return m_async_return;
+ }
+ ndbout_c("wait returned nothing...");
+ return -1;
+}
+
HugoOperations::HugoOperations(const NdbDictionary::Table& _tab):
UtilTransactions(_tab),
calc(_tab),
- pTrans(NULL){
-
+ pTrans(NULL)
+{
}
HugoOperations::~HugoOperations(){
deallocRows();
- if (pTrans != NULL){
+ if (pTrans != NULL)
+ {
pTrans->close();
pTrans = NULL;
}