您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GETNDB函数代码示例

51自学网 2021-06-01 20:50:44
  C++
这篇教程C++ GETNDB函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GETNDB函数的典型用法代码示例。如果您正苦于以下问题:C++ GETNDB函数的具体用法?C++ GETNDB怎么用?C++ GETNDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GETNDB函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: runVerifyOne

int runVerifyOne(NDBT_Context* ctx, NDBT_Step* step){  int records = ctx->getNumRecords();  Ndb* pNdb = GETNDB(step);  int result = NDBT_OK;  int count = 0;  const NdbDictionary::Table* tab =     GETNDB(step)->getDictionary()->getTable(ctx->getTab()->getName());  if(tab == 0)    return NDBT_FAILED;    UtilTransactions utilTrans(* tab);  HugoTransactions hugoTrans(* tab);  do{    // Check that there are as many records as we expected    CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0);    g_err << "count = " << count;    g_err << " records = " << records;    g_err << endl;    CHECK(count == records);    // Read and verify every record    CHECK(hugoTrans.pkReadRecords(pNdb, records) == 0);      } while (false);  return result;}
开发者ID:A-eolus,项目名称:mysql,代码行数:32,


示例2: runScanJoin

intrunScanJoin(NDBT_Context* ctx, NDBT_Step* step){  int loops = ctx->getNumLoops();  int joinlevel = ctx->getProperty("JoinLevel", 3);  int until_stopped = ctx->getProperty("UntilStopped", (Uint32)0);  Uint32 stepNo = step->getStepNo();  int i = 0;  HugoQueryBuilder qb(GETNDB(step), ctx->getTab(), HugoQueryBuilder::O_SCAN);  qb.setJoinLevel(joinlevel);  const NdbQueryDef * query = qb.createQuery(GETNDB(step));  HugoQueries hugoTrans(* query);  while ((i<loops || until_stopped) && !ctx->isTestStopped())  {    g_info << i << ": ";    if (hugoTrans.runScanQuery(GETNDB(step)))    {      g_info << endl;      return NDBT_FAILED;    }    addMask(ctx, (1 << stepNo), "Running");    i++;  }  g_info << endl;  return NDBT_OK;}
开发者ID:Cona19,项目名称:mysql5.6.24-improve,代码行数:26,


示例3: runPkDelete

int runPkDelete(NDBT_Context* ctx, NDBT_Step* step){  int loops = ctx->getNumLoops();  int records = ctx->getNumRecords();  int batchSize = ctx->getProperty("BatchSize", 1);  int transactions = (records / 100) + 1;  int operations = (records / transactions) + 1;  int i = 0;  HugoAsynchTransactions hugoTrans(*ctx->getTab());  while (i<loops) {    ndbout << i << ": ";    if (hugoTrans.pkDelRecordsAsynch(GETNDB(step),  records, batchSize,				     transactions, operations) != 0){      return NDBT_FAILED;    }    // Load table, don't allow any primary key violations    if (hugoTrans.loadTableAsynch(GETNDB(step), records, batchSize, 				  transactions, operations) != 0){      return NDBT_FAILED;    }    i++;  }    return NDBT_OK;}
开发者ID:A-eolus,项目名称:mysql,代码行数:25,


示例4: runVerifyUndoData

int runVerifyUndoData(NDBT_Context* ctx, NDBT_Step* step){  int records = ctx->getNumRecords();  Ndb* pNdb = GETNDB(step);  int count = 0;  int num = 5;  if (records - 5 < 0)    num = 1;  const NdbDictionary::Table* tab =     GETNDB(step)->getDictionary()->getTable(ctx->getTab()->getName());  if(tab == 0) {    g_err << " Can't find table" << endl;    return NDBT_FAILED;  }    UtilTransactions utilTrans(* tab);  HugoTransactions hugoTrans(* tab);  // Check that there are as many records as we expected  if(utilTrans.selectCount(pNdb, 64, &count) != 0) {    g_err << "Can't get records count" << endl;    return NDBT_FAILED;  }  g_err << "count = " << count;  g_err << " records = " << records;  g_err << endl;  if (count != records) {    g_err << "The records count is not correct" << endl;    return NDBT_FAILED;  }  // make sure all the update data is there  NdbTransaction *pTransaction= pNdb->startTransaction();  if (pTransaction == NULL) {    g_err << "Can't get transaction pointer" << endl;    return NDBT_FAILED;  }  if(hugoTrans.setTransaction(pTransaction) != 0) {    g_err << "Set transaction error" << endl;    pNdb->closeTransaction(pTransaction);    return NDBT_FAILED;  }   if(hugoTrans.pkReadRecord(pNdb, 0, records, NdbOperation::LM_Read) != 0) {      g_err << "Can't read record" << endl;      return NDBT_FAILED;    }  if(hugoTrans.verifyUpdatesValue(0, records) != 0) {    g_err << "The records restored with undo log is not correct" << endl;    return NDBT_FAILED;  }  hugoTrans.closeTransaction(pNdb);  return NDBT_OK;}
开发者ID:Cona19,项目名称:mysql5.6.24-improve,代码行数:57,


示例5: runBackupBank

int runBackupBank(NDBT_Context* ctx, NDBT_Step* step){  int loops = ctx->getNumLoops();  int l = 0;  int maxSleep = 30; // Max seconds between each backup  Ndb* pNdb = GETNDB(step);  NdbBackup backup(GETNDB(step)->getNodeId()+1);  unsigned minBackupId = ~0;  unsigned maxBackupId = 0;  unsigned backupId = 0;  int result = NDBT_OK;  while (l < loops && result != NDBT_FAILED){    if (pNdb->waitUntilReady() != 0){      result = NDBT_FAILED;      continue;    }    // Sleep for a while    NdbSleep_SecSleep(maxSleep);        // Perform backup    if (backup.start(backupId) != 0){      ndbout << "backup.start failed" << endl;      result = NDBT_FAILED;      continue;    }    ndbout << "Started backup " << backupId << endl;    // Remember min and max backupid    if (backupId < minBackupId)      minBackupId = backupId;    if (backupId > maxBackupId)      maxBackupId = backupId;        ndbout << " maxBackupId = " << maxBackupId 	   << ", minBackupId = " << minBackupId << endl;    ctx->setProperty("MinBackupId", minBackupId);        ctx->setProperty("MaxBackupId", maxBackupId);            l++;  }  ctx->stopTest();  return result;}
开发者ID:A-eolus,项目名称:mysql,代码行数:48,


示例6: runRestartGciControl

int runRestartGciControl(NDBT_Context* ctx, NDBT_Step* step){  int records = ctx->getNumRecords();  Ndb* pNdb = GETNDB(step);  UtilTransactions utilTrans(*ctx->getTab());  NdbRestarter restarter;    // Wait until we have enough records in db  int count = 0;  while (count < records){    if (utilTrans.selectCount(pNdb, 64, &count) != 0){      ctx->stopTest();      return NDBT_FAILED;    }  }  // Restart cluster with abort  if (restarter.restartAll(false, false, true) != 0){    ctx->stopTest();    return NDBT_FAILED;  }  // Stop the other thread  ctx->stopTest();  if (restarter.waitClusterStarted(300) != 0){    return NDBT_FAILED;  }    if (pNdb->waitUntilReady() != 0){    return NDBT_FAILED;  }  return NDBT_OK;}
开发者ID:Abner-Sun,项目名称:mysql5.1-vx-pre1,代码行数:34,


示例7: runInsertRememberGci

int runInsertRememberGci(NDBT_Context* ctx, NDBT_Step* step){  int result = NDBT_OK;  int records = ctx->getNumRecords();  HugoOperations hugoOps(*ctx->getTab());  Ndb* pNdb = GETNDB(step);  int i = 0;  while(ctx->isTestStopped() == false && i < records){    // Insert record and read it in same transaction    CHECK(hugoOps.startTransaction(pNdb) == 0);    CHECK(hugoOps.pkInsertRecord(pNdb, i) == 0);    if (hugoOps.execute_NoCommit(pNdb) != 0){      ndbout << "Could not insert record " << i << endl;      result = NDBT_FAILED;      break;    }    CHECK(hugoOps.pkReadRecord(pNdb, i) == 0);    if (hugoOps.execute_Commit(pNdb) != 0){      ndbout << "Did not find record in DB " << i << endl;      result = NDBT_FAILED;      break;    }    savedRecords.push_back(SavedRecord(hugoOps.getRecordGci(0),				     hugoOps.getRecordStr(0)));    CHECK(hugoOps.closeTransaction(pNdb) == 0);    i++;  };  return result;}
开发者ID:Abner-Sun,项目名称:mysql5.1-vx-pre1,代码行数:31,


示例8: runSetup

int runSetup(NDBT_Context* ctx, NDBT_Step* step, int waitGroupSize){  int records = ctx->getNumRecords();  int batchSize = ctx->getProperty("BatchSize", 1);  int transactions = (records / 100) + 1;  int operations = (records / transactions) + 1;  Ndb* pNdb = GETNDB(step);  HugoAsynchTransactions hugoTrans(*ctx->getTab());  if (hugoTrans.loadTableAsynch(pNdb, records, batchSize,				transactions, operations) != 0){    return NDBT_FAILED;  }  Ndb_cluster_connection* conn = &pNdb->get_ndb_cluster_connection();  /* The first call to create_multi_ndb_wait_group() should succeed ... */  global_poll_group = conn->create_ndb_wait_group(waitGroupSize);  if(global_poll_group == 0) {    return NDBT_FAILED;  }  /* and subsequent calls should fail */  if(conn->create_ndb_wait_group(waitGroupSize) != 0) {    return NDBT_FAILED;  }  return NDBT_OK;}
开发者ID:ForcerKing,项目名称:ShaoqunXu-mysql5.7,代码行数:29,


示例9: runMiscUntilStopped

int runMiscUntilStopped(NDBT_Context* ctx, NDBT_Step* step){  int records = ctx->getNumRecords();  int i = 0;  Ndb * ndb = GETNDB(step);  HugoTransactions hugoTrans(*ctx->getTab());  while (ctx->isTestStopped() == false) {    int r = 0;    switch(i % 5) {      case 0:  // batch size = 2, random = 1        r = hugoTrans.pkReadRecords(ndb, records / 20, 2,                                     NdbOperation::LM_Read, 1);        break;      case 1:        r = hugoTrans.pkUpdateRecords(ndb, records / 20);        break;      case 2:        r = hugoTrans.scanReadRecords(ndb, records);        break;      case 3:        r = hugoTrans.scanUpdateRecords(ndb, records / 10);        break;      case 4:        NdbSleep_MilliSleep(records);        break;    }    if(r != 0) return NDBT_FAILED;    i++;  }  ndbout << "V2 Test misc thread: " << i << " transactions" << endl;  return NDBT_OK;}
开发者ID:ForcerKing,项目名称:ShaoqunXu-mysql5.7,代码行数:31,


示例10: runError4012

int runError4012(NDBT_Context* ctx, NDBT_Step* step){  int result = NDBT_OK;  int loops = ctx->getNumLoops();  int stepNo = step->getStepNo();    int timeout = ctx->getProperty("TransactionDeadlockTimeout", TIMEOUT);  HugoOperations hugoOps(*ctx->getTab());  Ndb* pNdb = GETNDB(step);  do{    // Commit transaction    CHECK(hugoOps.startTransaction(pNdb) == 0);    CHECK(hugoOps.pkUpdateRecord(pNdb, 0) == 0);    int ret = hugoOps.execute_NoCommit(pNdb);    if (ret == 0)    {      int sleep = timeout;      ndbout << "Sleeping for " << sleep << " milliseconds" << endl;      NdbSleep_MilliSleep(sleep);            // Expect that transaction has NOT timed-out      CHECK(hugoOps.execute_Commit(pNdb) == 0);    }    else    {      CHECK(ret == 4012);    }  } while(false);    hugoOps.closeTransaction(pNdb);    return result;}
开发者ID:A-eolus,项目名称:mysql,代码行数:35,


示例11: runDDL

intrunDDL(NDBT_Context* ctx, NDBT_Step* step){  Ndb* pNdb= GETNDB(step);  NdbDictionary::Dictionary* pDict = pNdb->getDictionary();    const int tables = NDBT_Tables::getNumTables();  while(!ctx->isTestStopped())  {    const int tab_no = rand() % (tables);    NdbDictionary::Table tab = *NDBT_Tables::getTable(tab_no);    BaseString name= tab.getName();    name.appfmt("-%d", step->getStepNo());    tab.setName(name.c_str());    if(pDict->createTable(tab) == 0)    {      HugoTransactions hugoTrans(* pDict->getTable(name.c_str()));      if (hugoTrans.loadTable(pNdb, 10000) != 0){	return NDBT_FAILED;      }            while(pDict->dropTable(tab.getName()) != 0 &&	    pDict->getNdbError().code != 4009)	g_err << pDict->getNdbError() << endl;            sleep(1);    }  }  return NDBT_OK;}
开发者ID:A-eolus,项目名称:mysql,代码行数:30,


示例12: runFail

int runFail(NDBT_Context* ctx, NDBT_Step* step){  NdbBackup backup(GETNDB(step)->getNodeId()+1);  NdbRestarter restarter;  if (restarter.getNumDbNodes() < 2){    ctx->stopTest();    return NDBT_OK;  }  if(restarter.waitClusterStarted(60) != 0){    g_err << "Cluster failed to start" << endl;    return NDBT_FAILED;  }  if (testMaster) {    if (testSlave) {      if (backup.FailMasterAsSlave(restarter) != NDBT_OK){	return NDBT_FAILED;      }    } else {      if (backup.FailMaster(restarter) != NDBT_OK){	return NDBT_FAILED;      }    }  } else {    if (backup.FailSlave(restarter) != NDBT_OK){      return NDBT_FAILED;    }  }  return NDBT_OK;}
开发者ID:A-eolus,项目名称:mysql,代码行数:33,


示例13: 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;}
开发者ID:ForcerKing,项目名称:ShaoqunXu-mysql5.7,代码行数:60,


示例14: clearOldBackups

intclearOldBackups(NDBT_Context* ctx, NDBT_Step* step){  strcpy(tabname, ctx->getTab()->getName());  NdbBackup backup(GETNDB(step)->getNodeId());  backup.clearOldBackups();  return NDBT_OK;}
开发者ID:Cona19,项目名称:mysql5.6.24-improve,代码行数:8,


示例15: runDropTable

int runDropTable(NDBT_Context* ctx, NDBT_Step* step){    const NdbDictionary::Table *tab = ctx->getTab();  GETNDB(step)->getDictionary()->dropTable(tab->getName());    return NDBT_OK;}
开发者ID:Cona19,项目名称:mysql5.6.24-improve,代码行数:8,


示例16: runClearTable

int runClearTable(NDBT_Context* ctx, NDBT_Step* step){  int records = ctx->getNumRecords();    UtilTransactions utilTrans(*ctx->getTab());  if (utilTrans.clearTable2(GETNDB(step),  records) != 0){    return NDBT_FAILED;  }  return NDBT_OK;}
开发者ID:A-eolus,项目名称:mysql,代码行数:9,


示例17: runLoadTable

int runLoadTable(NDBT_Context* ctx, NDBT_Step* step){  int records = ctx->getNumRecords();  HugoTransactions hugoTrans(*ctx->getTab());  if (hugoTrans.loadTable(GETNDB(step), records) != 0){    return NDBT_FAILED;  }  return NDBT_OK;}
开发者ID:A-eolus,项目名称:mysql,代码行数:9,


示例18: runClearTable

intrunClearTable(NDBT_Context* ctx, NDBT_Step* step){  UtilTransactions utilTrans(*ctx->getTab());  if (utilTrans.clearTable(GETNDB(step)) != 0){    return NDBT_FAILED;  }  return NDBT_OK;}
开发者ID:Cona19,项目名称:mysql5.6.24-improve,代码行数:9,


示例19: runCreateEvent

int runCreateEvent(NDBT_Context* ctx, NDBT_Step* step){  HugoTransactions hugoTrans(*ctx->getTab());  if (hugoTrans.createEvent(GETNDB(step)) != 0){    return NDBT_FAILED;  }  return NDBT_OK;}
开发者ID:isleon,项目名称:Jaxer,代码行数:9,


示例20: runDeadlockTimeoutTrans

int runDeadlockTimeoutTrans(NDBT_Context* ctx, NDBT_Step* step){  int result = NDBT_OK;  int loops = ctx->getNumLoops();  int stepNo = step->getStepNo();  Uint32 deadlock_timeout;  NdbConfig conf(GETNDB(step)->getNodeId()+1);  unsigned int nodeId = conf.getMasterNodeId();  if (!conf.getProperty(nodeId,                        NODE_TYPE_DB,                        CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT,                        &deadlock_timeout)){    return NDBT_FAILED;  }  int do_sleep = (int)(deadlock_timeout * 0.5);  HugoOperations hugoOps(*ctx->getTab());  Ndb* pNdb = GETNDB(step);  for (int l = 0; l < loops && result == NDBT_OK; l++){    do{      // Commit transaction      CHECK(hugoOps.startTransaction(pNdb) == 0);      CHECK(hugoOps.pkReadRecord(pNdb, stepNo) == 0);      CHECK(hugoOps.execute_NoCommit(pNdb) == 0);      int sleep = deadlock_timeout * 1.5 + myRandom48(do_sleep);      ndbout << "Sleeping for " << sleep << " milliseconds" << endl;      NdbSleep_MilliSleep(sleep);      // Expect that transaction has NOT timed-out      CHECK(hugoOps.execute_Commit(pNdb) == 0);    } while(false);    hugoOps.closeTransaction(pNdb);  }  return result;}
开发者ID:A-eolus,项目名称:mysql,代码行数:44,


示例21: runEventLoad

int runEventLoad(NDBT_Context* ctx, NDBT_Step* step){  int loops = ctx->getNumLoops();  int records = ctx->getNumRecords();  HugoTransactions hugoTrans(*ctx->getTab());  sleep(5);  sleep(theThreadIdCounter);  if (hugoTrans.loadTable(GETNDB(step), records, 1, true, loops) != 0){    return NDBT_FAILED;  }  if (hugoTrans.pkUpdateRecords(GETNDB(step), records, 1, loops) != 0){    return NDBT_FAILED;  }  if (hugoTrans.pkDelRecords(GETNDB(step),  records, 1, true, loops) != 0){    return NDBT_FAILED;  }  return NDBT_OK;}
开发者ID:isleon,项目名称:Jaxer,代码行数:20,



注:本文中的GETNDB函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GETOPERAND函数代码示例
C++ GETJOCTET函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。