本文整理汇总了C++中Ndb::NdbTamper方法的典型用法代码示例。如果您正苦于以下问题:C++ Ndb::NdbTamper方法的具体用法?C++ Ndb::NdbTamper怎么用?C++ Ndb::NdbTamper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ndb
的用法示例。
在下文中一共展示了Ndb::NdbTamper方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runVerifyInserts
int runVerifyInserts(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
Ndb* pNdb = GETNDB(step);
UtilTransactions utilTrans(*ctx->getTab());
HugoOperations hugoOps(*ctx->getTab());
NdbRestarter restarter;
int restartGCI = pNdb->NdbTamper(Ndb::ReadRestartGCI, 0);
ndbout << "restartGCI = " << restartGCI << endl;
int count = 0;
if (utilTrans.selectCount(pNdb, 64, &count) != 0){
return NDBT_FAILED;
}
// RULE1: The vector with saved records should have exactly as many
// records with lower or same gci as there are in DB
int recordsWithLowerOrSameGci = 0;
unsigned i;
for (i = 0; i < savedRecords.size(); i++){
if (savedRecords[i].m_gci <= restartGCI)
recordsWithLowerOrSameGci++;
}
if (recordsWithLowerOrSameGci != count){
ndbout << "ERR: Wrong number of expected records" << endl;
result = NDBT_FAILED;
}
// RULE2: The records found in db should have same or lower
// gci as in the vector
for (i = 0; i < savedRecords.size(); i++){
CHECK(hugoOps.startTransaction(pNdb) == 0);
CHECK(hugoOps.pkReadRecord(pNdb, i) == 0);
if (hugoOps.execute_Commit(pNdb) != 0){
// Record was not found in db'
// Check record gci
if (savedRecords[i].m_gci <= restartGCI){
ndbout << "ERR: Record "<<i<<" should have existed" << endl;
result = NDBT_FAILED;
}
} else {
// Record was found in db
BaseString str = hugoOps.getRecordStr(0);
// Check record string
if (!(savedRecords[i].m_str == str)){
ndbout << "ERR: Record "<<i<<" str did not match "<< endl;
result = NDBT_FAILED;
}
// Check record gci
if (savedRecords[i].m_gci > restartGCI){
ndbout << "ERR: Record "<<i<<" should not have existed" << endl;
result = NDBT_FAILED;
}
}
CHECK(hugoOps.closeTransaction(pNdb) == 0);
}
ndbout << "There are " << count << " records in db" << endl;
ndbout << "There are " << savedRecords.size()
<< " records in vector" << endl;
ndbout << "There are " << recordsWithLowerOrSameGci
<< " records with lower or same gci than " << restartGCI << endl;
return result;
}