当前位置: 首页>>代码示例>>C++>>正文


C++ NdbConnection::executeAsynchPrepare方法代码示例

本文整理汇总了C++中NdbConnection::executeAsynchPrepare方法的典型用法代码示例。如果您正苦于以下问题:C++ NdbConnection::executeAsynchPrepare方法的具体用法?C++ NdbConnection::executeAsynchPrepare怎么用?C++ NdbConnection::executeAsynchPrepare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NdbConnection的用法示例。


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

示例1:

/**
 * Transaction 2 - T2
 *
 * Read from Subscriber:
 *
 * Input: 
 *   SubscriberNumber
 *
 * Output:
 *   Location
 *   Changed by
 *   Changed Timestamp
 *   Name
 */
void
start_T2(Ndb * pNDB, ThreadData * td){

  DEBUG3("T2(%.*s, %p): - Starting\n", SUBSCRIBER_NUMBER_LENGTH, 
	 td->transactionData.number, 
	 td->transactionData.location);
  
  int check;
  NdbRecAttr * check2;
  
  NdbConnection * pCON = pNDB->startTransaction();
  if (pCON == NULL)	  
    error_handler("T2-1: startTransaction", 
		  pNDB->getNdbErrorString(), 
		  pNDB->getNdbError());
  
  NdbOperation *MyOp= pCON->getNdbOperation(SUBSCRIBER_TABLE);
  CHECK_NULL(MyOp, "T2: getNdbOperation", 
	     pCON);
  
  MyOp->readTuple();
  MyOp->equal(IND_SUBSCRIBER_NUMBER,
	      td->transactionData.number);
  MyOp->getValue(IND_SUBSCRIBER_LOCATION, 
		 (char *)&td->transactionData.location);
  MyOp->getValue(IND_SUBSCRIBER_CHANGED_BY, 
		 td->transactionData.changed_by);
  MyOp->getValue(IND_SUBSCRIBER_CHANGED_TIME, 
		 td->transactionData.changed_time);
  MyOp->getValue(IND_SUBSCRIBER_NAME, 
		 td->transactionData.name);
  pCON->executeAsynchPrepare( Commit, T2_Callback, td ); 
}
开发者ID:Cona19,项目名称:mysql5.6.24-improve,代码行数:47,代码来源:ndb_async1.cpp

示例2: while

void
start_T1(Ndb * pNDB, ThreadData * td, int async){

  DEBUG2("T1(%.*s): - Starting", SUBSCRIBER_NUMBER_LENGTH, 
	 td->transactionData.number); 

  NdbConnection * pCON = 0;
  while((pCON = startTransaction(pNDB, td)) == 0){
    CHECK_ALLOWED_ERROR("T1: startTransaction", td, pNDB->getNdbError());
    NdbSleep_MilliSleep(10);
  }

  NdbOperation *MyOp = pCON->getNdbOperation(SUBSCRIBER_TABLE);
  if (MyOp != NULL) {  
    MyOp->updateTuple();  
    MyOp->equal(IND_SUBSCRIBER_NUMBER, 
		td->transactionData.number);
    MyOp->setValue(IND_SUBSCRIBER_LOCATION, 
		   (char *)&td->transactionData.location);
    MyOp->setValue(IND_SUBSCRIBER_CHANGED_BY, 
		   td->transactionData.changed_by);
    MyOp->setValue(IND_SUBSCRIBER_CHANGED_TIME, 
		   td->transactionData.changed_time);
    if (async == 1) {
      pCON->executeAsynchPrepare( Commit , T1_Callback, td);
    } else {
      int result = pCON->execute(Commit);
      T1_Callback(result, pCON, (void*)td);
      return;
    }//if
  } else {
    CHECK_NULL(MyOp, "T1: getNdbOperation", td, pCON->getNdbError());
  }//if
}
开发者ID:4T-Shirt,项目名称:mysql,代码行数:34,代码来源:ndb_async2.cpp

示例3: while

/**
 * Transaction 2 - T2
 *
 * Read from Subscriber:
 *
 * Input:
 *   SubscriberNumber
 *
 * Output:
 *   Location
 *   Changed by
 *   Changed Timestamp
 *   Name
 */
void
start_T2(Ndb * pNDB, ThreadData * td, int async) {

    DEBUG3("T2(%.*s, %d): - Starting", SUBSCRIBER_NUMBER_LENGTH,
           td->transactionData.number,
           td->transactionData.location);

    NdbConnection * pCON = 0;

    while((pCON = startTransaction(pNDB, td)) == 0) {
        CHECK_ALLOWED_ERROR("T2-1: startTransaction", td, pNDB->getNdbError());
        NdbSleep_MilliSleep(10);
    }

    if (td->ndbRecordSharedData)
    {
        char* rowPtr= (char*) &td->transactionData;
        const NdbRecord* record= td->ndbRecordSharedData->
                                 subscriberTableNdbRecord;
        Uint32 m=0;
        unsigned char* mask= (unsigned char*) &m;

        SET_MASK(mask, IND_SUBSCRIBER_LOCATION);
        SET_MASK(mask, IND_SUBSCRIBER_CHANGED_BY);
        SET_MASK(mask, IND_SUBSCRIBER_CHANGED_TIME);
        SET_MASK(mask, IND_SUBSCRIBER_NAME);

        const NdbOperation* MyOp= pCON->readTuple(record, rowPtr, record, rowPtr,
                                  NdbOperation::LM_Read, mask);
        CHECK_NULL((void*) MyOp, "T2: readTuple", td,
                   pCON->getNdbError());
    }
    else
    {
        NdbOperation *MyOp= pCON->getNdbOperation(SUBSCRIBER_TABLE);
        CHECK_NULL(MyOp, "T2: getNdbOperation", td,
                   pCON->getNdbError());

        MyOp->readTuple();
        MyOp->equal(IND_SUBSCRIBER_NUMBER,
                    td->transactionData.number);
        MyOp->getValue(IND_SUBSCRIBER_LOCATION,
                       (char *)&td->transactionData.location);
        MyOp->getValue(IND_SUBSCRIBER_CHANGED_BY,
                       td->transactionData.changed_by);
        MyOp->getValue(IND_SUBSCRIBER_CHANGED_TIME,
                       td->transactionData.changed_time);
        MyOp->getValue(IND_SUBSCRIBER_NAME,
                       td->transactionData.name);
    }

    if (async == 1) {
        pCON->executeAsynchPrepare( Commit , T2_Callback, td);
    } else {
        int result = pCON->execute(Commit);
        T2_Callback(result, pCON, (void*)td);
        return;
    }//if
}
开发者ID:jimodb,项目名称:codes,代码行数:73,代码来源:ndb_async2.cpp

示例4: startTransaction

/**
 * Transaction 4 - T4
 * 
 * Create session
 *
 * Input:
 *   SubscriberNumber
 *   ServerId
 *   ServerBit
 *   SessionDetails,
 *   DoRollback
 * Output:
 *   ChangedBy
 *   ChangedTime
 *   Location
 *   BranchExecuted
 */
void
start_T4(Ndb * pNDB, ThreadData * td){

  DEBUG3("T4(%.*s, %.2d): - Starting\n", SUBSCRIBER_NUMBER_LENGTH, 
	 td->transactionData.number, 
	 td->transactionData.server_id);
  
  int check;
  NdbRecAttr * check2;
  
  NdbConnection * pCON = startTransaction(pNDB, 
					  td->transactionData.server_id, 
					  td->transactionData.number);
  if (pCON == NULL)	  
    error_handler("T4-1: startTranscation", 
		  pNDB->getNdbErrorString(), 
		  pNDB->getNdbError());
  
  NdbOperation *MyOp= pCON->getNdbOperation(SUBSCRIBER_TABLE);
  CHECK_NULL(MyOp, "T4-1: getNdbOperation", 
	     pCON);
  
  MyOp->interpretedUpdateTuple();
  MyOp->equal(IND_SUBSCRIBER_NUMBER, 
	      td->transactionData.number);
  MyOp->getValue(IND_SUBSCRIBER_LOCATION, 
		 (char *)&td->transactionData.location);
  MyOp->getValue(IND_SUBSCRIBER_CHANGED_BY, 
		 td->transactionData.changed_by);
  MyOp->getValue(IND_SUBSCRIBER_CHANGED_TIME, 
		 td->transactionData.changed_time);
  MyOp->getValue(IND_SUBSCRIBER_GROUP,
		 (char *)&td->transactionData.group_id);
  MyOp->getValue(IND_SUBSCRIBER_SESSIONS,
		 (char *)&td->transactionData.sessions); 
  MyOp->incValue(IND_SUBSCRIBER_SESSIONS, 
		 (uint32)td->transactionData.server_bit);
  pCON->executeAsynchPrepare( NoCommit , T4_Callback_1, td); 
}
开发者ID:Cona19,项目名称:mysql5.6.24-improve,代码行数:56,代码来源:ndb_async1.cpp

示例5: program


//.........这里部分代码省略.........
                                  mask);
        CHECK_NULL((void*)MyOp, "T5-1: readTuple", td,
                   pCON->getNdbError());

        m= 0;

        /* Create program to subtract something from the
         * subscriber sessions column
         */
        Uint32 codeBuf[20];
        NdbInterpretedCode program(pNDB->getDictionary()->
                                   getTable(SUBSCRIBER_TABLE),
                                   codeBuf,
                                   20);
        if (program.sub_val(IND_SUBSCRIBER_SESSIONS,
                            (uint32)td->transactionData.server_bit) ||
                program.interpret_exit_ok() ||
                program.finalise())
        {
            CHECK_NULL(NULL , "T5: Program create failed", td,
                       program.getNdbError());
        }
        NdbOperation::OperationOptions opts;
        opts.optionsPresent= NdbOperation::OperationOptions::OO_INTERPRETED;
        opts.interpretedCode= &program;

        MyOp= pCON->updateTuple(record, rowPtr, record, rowPtr,
                                mask,
                                &opts,
                                sizeof(opts));
        CHECK_NULL((void*)MyOp, "T5-1: updateTuple", td,
                   pCON->getNdbError());
    }
    else
    {
        /* Use old Api */
        if (td->useCombinedUpdate)
        {
            NdbOperation * MyOp= pCON->getNdbOperation(SUBSCRIBER_TABLE);
            CHECK_NULL(MyOp, "T5-1: getNdbOperation", td,
                       pCON->getNdbError());

            MyOp->interpretedUpdateTuple();
            MyOp->equal(IND_SUBSCRIBER_NUMBER,
                        td->transactionData.number);
            MyOp->getValue(IND_SUBSCRIBER_LOCATION,
                           (char *)&td->transactionData.location);
            MyOp->getValue(IND_SUBSCRIBER_CHANGED_BY,
                           td->transactionData.changed_by);
            MyOp->getValue(IND_SUBSCRIBER_CHANGED_TIME,
                           td->transactionData.changed_time);
            MyOp->getValue(IND_SUBSCRIBER_GROUP,
                           (char *)&td->transactionData.group_id);
            MyOp->getValue(IND_SUBSCRIBER_SESSIONS,
                           (char *)&td->transactionData.sessions);
            MyOp->subValue(IND_SUBSCRIBER_SESSIONS,
                           (uint32)td->transactionData.server_bit);
        }
        else
        {
            /* Use separate read and update operations
             * This relies on execution ordering between operations on
             * the same row
             */
            NdbOperation * MyOp= pCON->getNdbOperation(SUBSCRIBER_TABLE);
            CHECK_NULL(MyOp, "T5-1: getNdbOperation (readTuple)", td,
                       pCON->getNdbError());
            MyOp->readTuple();
            MyOp->equal(IND_SUBSCRIBER_NUMBER,
                        td->transactionData.number);
            MyOp->getValue(IND_SUBSCRIBER_LOCATION,
                           (char *)&td->transactionData.location);
            MyOp->getValue(IND_SUBSCRIBER_CHANGED_BY,
                           td->transactionData.changed_by);
            MyOp->getValue(IND_SUBSCRIBER_CHANGED_TIME,
                           td->transactionData.changed_time);
            MyOp->getValue(IND_SUBSCRIBER_GROUP,
                           (char *)&td->transactionData.group_id);
            MyOp->getValue(IND_SUBSCRIBER_SESSIONS,
                           (char *)&td->transactionData.sessions);

            MyOp= pCON->getNdbOperation(SUBSCRIBER_TABLE);
            CHECK_NULL(MyOp, "T5-1: getNdbOperation (updateTuple)", td,
                       pCON->getNdbError());
            MyOp->interpretedUpdateTuple();
            MyOp->equal(IND_SUBSCRIBER_NUMBER,
                        td->transactionData.number);
            MyOp->subValue(IND_SUBSCRIBER_SESSIONS,
                           (uint32)td->transactionData.server_bit);
        }
    }
    stat_async = async;
    if (async == 1) {
        pCON->executeAsynchPrepare( NoCommit , T5_Callback_1, td);
    } else {
        int result = pCON->execute( NoCommit );
        T5_Callback_1(result, pCON, (void*)td);
        return;
    }//if
}
开发者ID:jimodb,项目名称:codes,代码行数:101,代码来源:ndb_async2.cpp


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