summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <knielsen@ymer.(none)>2007-04-25 15:31:05 +0200
committerunknown <knielsen@ymer.(none)>2007-04-25 15:31:05 +0200
commit806e35280ea353d4377ce5732c34f5932c0cf077 (patch)
tree52114e328c18a19bf7cccf2cbbb00e6bce2f3183
parent9a9ff1501264f2cf2394cd2add04549b9e121710 (diff)
parent2399e1c994c3b2fbdea89be41fe2ac2225da1e8d (diff)
downloadmariadb-git-806e35280ea353d4377ce5732c34f5932c0cf077.tar.gz
Merge ymer.(none):/usr/local/mysql/mysql-5.0-telco-gca
into ymer.(none):/usr/local/mysql/mysql-5.0-ndb ndb/include/ndbapi/NdbTransaction.hpp: Auto merged ndb/src/ndbapi/NdbTransaction.cpp: Auto merged ndb/test/run-test/daily-basic-tests.txt: Auto merged
-rw-r--r--ndb/include/ndbapi/NdbTransaction.hpp8
-rw-r--r--ndb/src/ndbapi/NdbTransaction.cpp11
-rw-r--r--ndb/test/ndbapi/testNdbApi.cpp74
-rw-r--r--ndb/test/run-test/daily-basic-tests.txt4
4 files changed, 94 insertions, 3 deletions
diff --git a/ndb/include/ndbapi/NdbTransaction.hpp b/ndb/include/ndbapi/NdbTransaction.hpp
index d3405633f80..966872755ca 100644
--- a/ndb/include/ndbapi/NdbTransaction.hpp
+++ b/ndb/include/ndbapi/NdbTransaction.hpp
@@ -379,14 +379,16 @@ public:
void executeAsynch(ExecType aTypeOfExec,
NdbAsynchCallback aCallback,
void* anyObject,
- AbortOption abortOption = AbortOnError);
+ AbortOption abortOption = AbortOnError,
+ int forceSend= 0);
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
void executeAsynch(::ExecType aTypeOfExec,
NdbAsynchCallback aCallback,
void* anyObject,
- ::AbortOption abortOption= ::AbortOnError)
+ ::AbortOption abortOption= ::AbortOnError,
+ int forceSend= 0)
{ executeAsynch((ExecType)aTypeOfExec, aCallback, anyObject,
- (AbortOption)abortOption); }
+ (AbortOption)abortOption, forceSend); }
#endif
#endif
/**
diff --git a/ndb/src/ndbapi/NdbTransaction.cpp b/ndb/src/ndbapi/NdbTransaction.cpp
index 258330b3967..f5076ff2020 100644
--- a/ndb/src/ndbapi/NdbTransaction.cpp
+++ b/ndb/src/ndbapi/NdbTransaction.cpp
@@ -706,6 +706,17 @@ NdbTransaction::executeAsynchPrepare( ExecType aTypeOfExec,
DBUG_VOID_RETURN;
}//NdbTransaction::executeAsynchPrepare()
+void
+NdbTransaction::executeAsynch(ExecType aTypeOfExec,
+ NdbAsynchCallback aCallback,
+ void* anyObject,
+ AbortOption abortOption,
+ int forceSend)
+{
+ executeAsynchPrepare(aTypeOfExec, aCallback, anyObject, abortOption);
+ theNdb->sendPreparedTransactions(forceSend);
+}
+
void NdbTransaction::close()
{
theNdb->closeTransaction(this);
diff --git a/ndb/test/ndbapi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi.cpp
index a8ea420804e..aee668039fe 100644
--- a/ndb/test/ndbapi/testNdbApi.cpp
+++ b/ndb/test/ndbapi/testNdbApi.cpp
@@ -1234,6 +1234,76 @@ int runScan_4006(NDBT_Context* ctx, NDBT_Step* step){
return result;
}
+static void
+testExecuteAsynchCallback(int res, NdbTransaction *con, void *data_ptr)
+{
+ int *res_ptr= (int *)data_ptr;
+
+ *res_ptr= res;
+}
+
+int runTestExecuteAsynch(NDBT_Context* ctx, NDBT_Step* step){
+ /* Test that NdbTransaction::executeAsynch() works (BUG#27495). */
+ int result = NDBT_OK;
+ const NdbDictionary::Table* pTab = ctx->getTab();
+
+ Ndb* pNdb = new Ndb(&ctx->m_cluster_connection, "TEST_DB");
+ if (pNdb == NULL){
+ ndbout << "pNdb == NULL" << endl;
+ return NDBT_FAILED;
+ }
+ if (pNdb->init(2048)){
+ ERR(pNdb->getNdbError());
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+
+ NdbConnection* pCon = pNdb->startTransaction();
+ if (pCon == NULL){
+ ERR(pNdb->getNdbError());
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+
+ NdbScanOperation* pOp = pCon->getNdbScanOperation(pTab->getName());
+ if (pOp == NULL){
+ ERR(pOp->getNdbError());
+ pNdb->closeTransaction(pCon);
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+
+ if (pOp->readTuples() != 0){
+ ERR(pOp->getNdbError());
+ pNdb->closeTransaction(pCon);
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+
+ if (pOp->getValue(NdbDictionary::Column::FRAGMENT) == 0){
+ ERR(pOp->getNdbError());
+ pNdb->closeTransaction(pCon);
+ delete pNdb;
+ return NDBT_FAILED;
+ }
+ int res= 42;
+ pCon->executeAsynch(NoCommit, testExecuteAsynchCallback, &res);
+ while(pNdb->pollNdb(100000) == 0)
+ ;
+ if (res != 0){
+ ERR(pCon->getNdbError());
+ ndbout << "Error returned from execute: " << res << endl;
+ result= NDBT_FAILED;
+ }
+
+ pNdb->closeTransaction(pCon);
+
+ delete pNdb;
+
+ return result;
+}
+
+
template class Vector<NdbScanOperation*>;
@@ -1322,6 +1392,10 @@ TESTCASE("Scan_4006",
INITIALIZER(runScan_4006);
FINALIZER(runClearTable);
}
+TESTCASE("ExecuteAsynch",
+ "Check that executeAsync() works (BUG#27495)\n"){
+ INITIALIZER(runTestExecuteAsynch);
+}
NDBT_TESTSUITE_END(testNdbApi);
int main(int argc, const char** argv){
diff --git a/ndb/test/run-test/daily-basic-tests.txt b/ndb/test/run-test/daily-basic-tests.txt
index a35b2b3f7c7..ba74c09a792 100644
--- a/ndb/test/run-test/daily-basic-tests.txt
+++ b/ndb/test/run-test/daily-basic-tests.txt
@@ -625,6 +625,10 @@ max-time: 500
cmd: testNdbApi
args: -n Scan_4006 T1
+max-time: 500
+cmd: testNdbApi
+args: -n ExecuteAsynch T1
+
#max-time: 500
#cmd: testInterpreter
#args: T1