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


C++ NdbOperation::subValue方法代码示例

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


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

示例1: DEBUG


//.........这里部分代码省略.........
        /* Operation 3 */
        MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
        CHECK_NULL(MyOperation, "T5-3: getNdbOperation",
                   MyTransaction);

        check = MyOperation->deleteTuple();
        CHECK_MINUS_ONE(check, "T5-3: deleteTuple",
                        MyTransaction);

        check = MyOperation->equal(IND_SESSION_SUBSCRIBER,
                                   (char*)inNumber);
        CHECK_MINUS_ONE(check, "T5-3: equal number",
                        MyTransaction);

        check = MyOperation->equal(IND_SESSION_SERVER,
                                   (char*)&inServerId);
        CHECK_MINUS_ONE(check, "T5-3: equal server id",
                        MyTransaction);

        check = MyTransaction->execute( NoCommit );
        CHECK_MINUS_ONE(check, "T5-3: NoCommit",
                        MyTransaction);

        /* Operation 4 */
        MyOperation = MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
        CHECK_NULL(MyOperation, "T5-4: getNdbOperation",
                   MyTransaction);

        check = MyOperation->interpretedUpdateTuple();
        CHECK_MINUS_ONE(check, "T5-4: interpretedUpdateTuple",
                        MyTransaction);

        check = MyOperation->equal(IND_SUBSCRIBER_NUMBER,
                                   (char*)inNumber);
        CHECK_MINUS_ONE(check, "T5-4: equal number",
                        MyTransaction);

        check = MyOperation->subValue(IND_SUBSCRIBER_SESSIONS,
                                      (uint32)inServerBit);
        CHECK_MINUS_ONE(check, "T5-4: dec value",
                        MyTransaction);

        check = MyTransaction->execute( NoCommit );
        CHECK_MINUS_ONE(check, "T5-4: NoCommit",
                        MyTransaction);

        /* Operation 5 */
        MyOperation = MyTransaction->getNdbOperation(SERVER_TABLE);
        CHECK_NULL(MyOperation, "T5-5: getNdbOperation",
                   MyTransaction);


        check = MyOperation->interpretedUpdateTuple();
        CHECK_MINUS_ONE(check, "T5-5: interpretedUpdateTuple",
                        MyTransaction);

        check = MyOperation->equal(IND_SERVER_ID,
                                   (char*)&inServerId);
        CHECK_MINUS_ONE(check, "T5-5: equal serverId",
                        MyTransaction);

        check = MyOperation->equal(IND_SERVER_SUBSCRIBER_SUFFIX,
                                   (char*)inSuffix);
        CHECK_MINUS_ONE(check, "T5-5: equal suffix",
                        MyTransaction);

        check = MyOperation->incValue(IND_SERVER_DELETES, (uint32)1);
        CHECK_MINUS_ONE(check, "T5-5: inc value",
                        MyTransaction);

        check = MyTransaction->execute( NoCommit );
        CHECK_MINUS_ONE(check, "T5-5: NoCommit",
                        MyTransaction);

        (* outBranchExecuted) = 1;
    } else {
        DEBUG1("%s", ((permission & inServerBit) ? "permission - " : "no permission - "));
        DEBUG1("%s", ((sessions   & inServerBit) ? "in session - " : "no in session - "));
        (* outBranchExecuted) = 0;
    }

    if(!inDoRollback) {
        DEBUG("commit\n");
        check = MyTransaction->execute( Commit );
        CHECK_MINUS_ONE(check, "T5: Commit",
                        MyTransaction);
    } else {
        DEBUG("rollback\n");
        check = MyTransaction->execute(Rollback);
        CHECK_MINUS_ONE(check, "T5:Rollback",
                        MyTransaction);

    }

    pNDB->closeTransaction(MyTransaction);

    get_time(outTransactionTime);
    time_diff(outTransactionTime, &start);
    return 0;
}
开发者ID:colingpt,项目名称:mysql-5.5.36,代码行数:101,代码来源:ndb_user_transaction2.cpp

示例2: memcpy

/**
 * Transaction 5 - T5
 * 
 * Delete session
 *
 * Input:
 *   SubscriberNumber
 *   ServerId
 *   ServerBit
 *   DoRollback
 * Output:
 *   ChangedBy
 *   ChangedTime
 *   Location
 *   BranchExecuted
 */
void
userTransaction_T5(UserHandle * uh,
		   SubscriberNumber   inNumber,
		   ServerId           inServerId,
		   ServerBit          inServerBit,
		   DoRollback         inDoRollback,
		   BranchExecuted   * outBranchExecuted){
  Ndb * pNDB = uh->pNDB;

  DEBUG3("T5(%.*s, %.2d): ", SUBSCRIBER_NUMBER_LENGTH, inNumber, inServerId);

  NdbConnection * MyTransaction = 0;
  NdbOperation  * MyOperation = 0;

  char             outChangedBy   [sizeof(ChangedBy)  +(4-(sizeof(ChangedBy)   & 3))];
  char             outChangedTime [sizeof(ChangedTime)+(4-(sizeof(ChangedTime) & 3))];
  Location         outLocation;
  GroupId          groupId;
  ActiveSessions   sessions;
  Permission       permission;
  SubscriberSuffix inSuffix;

  int check;
  NdbRecAttr * check2;

  MyTransaction = pNDB->startTransaction();
  if (MyTransaction == NULL)	  
    error_handler("T5-1: startTranscation", pNDB->getNdbErrorString(), pNDB->getNdbError());
  
  MyOperation= MyTransaction->getNdbOperation(SUBSCRIBER_TABLE);
  CHECK_NULL(MyOperation, "T5-1: getNdbOperation", 
	     MyTransaction);
  
  MyOperation->interpretedUpdateTuple();
  MyOperation->equal(IND_SUBSCRIBER_NUMBER, 
		     inNumber);
  MyOperation->getValue(IND_SUBSCRIBER_LOCATION, 
		        (char *)&outLocation);
  MyOperation->getValue(IND_SUBSCRIBER_CHANGED_BY, 
			&outChangedBy[0]);
  MyOperation->getValue(IND_SUBSCRIBER_CHANGED_TIME, 
                        &outChangedTime[0]);
  MyOperation->getValue(IND_SUBSCRIBER_GROUP,
		        (char *)&groupId);
  MyOperation->getValue(IND_SUBSCRIBER_SESSIONS,
		        (char *)&sessions);
  MyOperation->subValue(IND_SUBSCRIBER_SESSIONS, 
		        (uint32)inServerBit);
  MyTransaction->execute( NoCommit ); 
    /* Operation 2 */

  MyOperation = MyTransaction->getNdbOperation(GROUP_TABLE);
  CHECK_NULL(MyOperation, "T5-2: getNdbOperation", 
	     MyTransaction);
    
  MyOperation->readTuple();
  MyOperation->equal(IND_GROUP_ID,
		     (char*)&groupId);
  MyOperation->getValue(IND_GROUP_ALLOW_DELETE, 
			(char *)&permission);
  check = MyTransaction->execute( NoCommit ); 
  CHECK_MINUS_ONE(check, "T5-2: NoCommit", 
		  MyTransaction);
  
  if(((permission & inServerBit) == inServerBit) &&
     ((sessions   & inServerBit) == inServerBit)){
  
    memcpy(inSuffix,
	   &inNumber[SUBSCRIBER_NUMBER_LENGTH-SUBSCRIBER_NUMBER_SUFFIX_LENGTH], SUBSCRIBER_NUMBER_SUFFIX_LENGTH);
    
    DEBUG2("deleting(%.*s) - ", SUBSCRIBER_NUMBER_SUFFIX_LENGTH, inSuffix);

    /* Operation 3 */
    MyOperation = MyTransaction->getNdbOperation(SESSION_TABLE);
    CHECK_NULL(MyOperation, "T5-3: getNdbOperation", 
	       MyTransaction);
    
    MyOperation->deleteTuple();
    MyOperation->equal(IND_SESSION_SUBSCRIBER,
		       (char*)inNumber);
    MyOperation->equal(IND_SESSION_SERVER,
		       (char*)&inServerId);
    /* Operation 4 */
        
//.........这里部分代码省略.........
开发者ID:0x00xw,项目名称:mysql-2,代码行数:101,代码来源:ndb_user_transaction6.cpp


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