mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -379,14 +379,16 @@ public:
|
|||||||
void executeAsynch(ExecType aTypeOfExec,
|
void executeAsynch(ExecType aTypeOfExec,
|
||||||
NdbAsynchCallback aCallback,
|
NdbAsynchCallback aCallback,
|
||||||
void* anyObject,
|
void* anyObject,
|
||||||
AbortOption abortOption = AbortOnError);
|
AbortOption abortOption = AbortOnError,
|
||||||
|
int forceSend= 0);
|
||||||
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
|
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
|
||||||
void executeAsynch(::ExecType aTypeOfExec,
|
void executeAsynch(::ExecType aTypeOfExec,
|
||||||
NdbAsynchCallback aCallback,
|
NdbAsynchCallback aCallback,
|
||||||
void* anyObject,
|
void* anyObject,
|
||||||
::AbortOption abortOption= ::AbortOnError)
|
::AbortOption abortOption= ::AbortOnError,
|
||||||
|
int forceSend= 0)
|
||||||
{ executeAsynch((ExecType)aTypeOfExec, aCallback, anyObject,
|
{ executeAsynch((ExecType)aTypeOfExec, aCallback, anyObject,
|
||||||
(AbortOption)abortOption); }
|
(AbortOption)abortOption, forceSend); }
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
|
@ -697,6 +697,17 @@ NdbTransaction::executeAsynchPrepare( ExecType aTypeOfExec,
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}//NdbTransaction::executeAsynchPrepare()
|
}//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()
|
void NdbTransaction::close()
|
||||||
{
|
{
|
||||||
theNdb->closeTransaction(this);
|
theNdb->closeTransaction(this);
|
||||||
|
@ -1249,6 +1249,76 @@ int runScan_4006(NDBT_Context* ctx, NDBT_Step* step){
|
|||||||
return result;
|
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*>;
|
template class Vector<NdbScanOperation*>;
|
||||||
|
|
||||||
|
|
||||||
@ -1342,6 +1412,10 @@ TESTCASE("Scan_4006",
|
|||||||
INITIALIZER(runScan_4006);
|
INITIALIZER(runScan_4006);
|
||||||
FINALIZER(runClearTable);
|
FINALIZER(runClearTable);
|
||||||
}
|
}
|
||||||
|
TESTCASE("ExecuteAsynch",
|
||||||
|
"Check that executeAsync() works (BUG#27495)\n"){
|
||||||
|
INITIALIZER(runTestExecuteAsynch);
|
||||||
|
}
|
||||||
NDBT_TESTSUITE_END(testNdbApi);
|
NDBT_TESTSUITE_END(testNdbApi);
|
||||||
|
|
||||||
int main(int argc, const char** argv){
|
int main(int argc, const char** argv){
|
||||||
|
@ -664,6 +664,10 @@ max-time: 500
|
|||||||
cmd: testNdbApi
|
cmd: testNdbApi
|
||||||
args: -n Bug_WritePartialIgnoreError T1
|
args: -n Bug_WritePartialIgnoreError T1
|
||||||
|
|
||||||
|
max-time: 500
|
||||||
|
cmd: testNdbApi
|
||||||
|
args: -n ExecuteAsynch T1
|
||||||
|
|
||||||
#max-time: 500
|
#max-time: 500
|
||||||
#cmd: testInterpreter
|
#cmd: testInterpreter
|
||||||
#args: T1
|
#args: T1
|
||||||
|
Reference in New Issue
Block a user