diff options
author | unknown <knielsen@ymer.(none)> | 2007-04-25 15:18:34 +0200 |
---|---|---|
committer | unknown <knielsen@ymer.(none)> | 2007-04-25 15:18:34 +0200 |
commit | 4ea948c5c959e3df11972236fabfea30e3d6fd0c (patch) | |
tree | 8837689be311ea2c7c0123e0d403981e8ee96ecf /storage/ndb/test/ndbapi/testNdbApi.cpp | |
parent | 21fe947986820a400bab327ac707dc9d55d080e4 (diff) | |
parent | 2399e1c994c3b2fbdea89be41fe2ac2225da1e8d (diff) | |
download | mariadb-git-4ea948c5c959e3df11972236fabfea30e3d6fd0c.tar.gz |
Merge ymer.(none):/usr/local/mysql/mysql-5.0-telco-gca
into ymer.(none):/usr/local/mysql/mysql-5.1-telco-gca
storage/ndb/include/ndbapi/NdbTransaction.hpp:
Auto merged
storage/ndb/src/ndbapi/NdbTransaction.cpp:
Auto merged
storage/ndb/test/ndbapi/testNdbApi.cpp:
Auto merged
storage/ndb/test/run-test/daily-basic-tests.txt:
Manual merge.
Diffstat (limited to 'storage/ndb/test/ndbapi/testNdbApi.cpp')
-rw-r--r-- | storage/ndb/test/ndbapi/testNdbApi.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/storage/ndb/test/ndbapi/testNdbApi.cpp b/storage/ndb/test/ndbapi/testNdbApi.cpp index 39a9c7656c0..77ee32d72ea 100644 --- a/storage/ndb/test/ndbapi/testNdbApi.cpp +++ b/storage/ndb/test/ndbapi/testNdbApi.cpp @@ -1249,6 +1249,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*>; @@ -1342,6 +1412,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){ |