本文整理汇总了C++中NdbTransaction::refresh方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbTransaction::refresh方法的具体用法?C++ NdbTransaction::refresh怎么用?C++ NdbTransaction::refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NdbTransaction
的用法示例。
在下文中一共展示了NdbTransaction::refresh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runScanRefreshNoTimeout
int runScanRefreshNoTimeout(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
int loops = ctx->getNumLoops();
int records = ctx->getNumRecords();
int stepNo = step->getStepNo();
int maxSleep = (int)(TIMEOUT * 0.3);
ndbout << "TransactionInactiveTimeout="<< TIMEOUT
<< ", maxSleep="<<maxSleep<<endl;
HugoOperations hugoOps(*ctx->getTab());
Ndb* pNdb = GETNDB(step);
for (int l = 1; l < loops && result == NDBT_OK; l++){
do{
// Start an insert trans
CHECK(hugoOps.startTransaction(pNdb) == 0);
int recordNo = records + (stepNo*loops) + l;
CHECK(hugoOps.pkInsertRecord(pNdb, recordNo) == 0);
CHECK(hugoOps.execute_NoCommit(pNdb) == 0);
for (int i = 0; i < 3; i++)
{
NdbTransaction* pTrans = hugoOps.getTransaction();
Vector<NdbScanOperation*> ops;
for (int j = 0; j <= i; j++)
{
// Perform buddy scan reads
NdbScanOperation* pOp = pTrans->getNdbScanOperation(ctx->getTab());
CHECK(pOp != 0);
CHECK(pOp->readTuples(NdbOperation::LM_Read, 0, 0, 1) == 0);
ops.push_back(pOp);
}
CHECK(pTrans->execute(NoCommit) == 0);
for (unsigned i = 0; i<TIMEOUT; i += 1000)
{
pTrans->refresh();
NdbSleep_MilliSleep(1000);
}
int res;
for (unsigned j = 0; j < ops.size(); j++)
{
while((res = ops[j]->nextResult()) == 0);
CHECK(res != -1);
}
}
// Expect that transaction has NOT timed-out
CHECK(hugoOps.execute_Commit(pNdb) == 0);
} while(false);
hugoOps.closeTransaction(pNdb);
}
return result;
}
示例2: getTransaction
void
HugoOperations::refresh() {
NdbTransaction * t = getTransaction();
if(t)
t->refresh();
}