⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ndboperationexec.cpp

📁 mysql-5.0.22.tar.gz源码包
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//-------------------------------------------------------------// Perform the Attrinfo packing in the TCKEYREQ signal started// above.//-------------------------------------------------------------  Uint32* tAIDataPtr = &tOptionalDataPtr[tAttrInfoIndex];  Tdata1 = tcKeyReq->attrInfo[0];  Tdata2 = tcKeyReq->attrInfo[1];  Tdata3 = tcKeyReq->attrInfo[2];  Tdata4 = tcKeyReq->attrInfo[3];  Tdata5 = tcKeyReq->attrInfo[4];  theTCREQ->setLength(tcKeyReq->getAIInTcKeyReq(tReqInfo) +                      tAttrInfoIndex + TcKeyReq::StaticLength);  tAIDataPtr[0] = Tdata1;  tAIDataPtr[1] = Tdata2;  tAIDataPtr[2] = Tdata3;  tAIDataPtr[3] = Tdata4;  tAIDataPtr[4] = Tdata5;/****************************************************  Send the ATTRINFO signals.***************************************************/  if (tTotalCurrAI_Len > 5) {    // Set the last signal's length.    NdbApiSignal* tSignal = theFirstATTRINFO;    theCurrentATTRINFO->setLength(theAI_LenInCurrAI);    do {      Uint32* tSigDataPtr = tSignal->getDataPtrSend();      NdbApiSignal* tnextSignal = tSignal->next();      tSigDataPtr[0] = aTC_ConnectPtr;      tSigDataPtr[1] = tTransId1;      tSigDataPtr[2] = tTransId2;      tSignal = tnextSignal;    } while (tSignal != NULL);  }//if  theStatus = WaitResponse;  theReceiver.prepareSend();  return 0;}//NdbOperation::prepareSend()/***************************************************************************int prepareSendInterpreted()Make preparations to send an interpreted operation.Return Value:   Return 0 : succesful.                Return -1: In all other case.   ***************************************************************************/intNdbOperation::prepareSendInterpreted(){  Uint32 tTotalCurrAI_Len = theTotalCurrAI_Len;  Uint32 tInitReadSize = theInitialReadSize;  if (theStatus == ExecInterpretedValue) {    if (insertATTRINFO(Interpreter::EXIT_OK) != -1) {//-------------------------------------------------------------------------// Since we read the total length before inserting the last entry in the// signals we need to add one to the total length.//-------------------------------------------------------------------------      theInterpretedSize = (tTotalCurrAI_Len + 1) -       (tInitReadSize + 5);    } else {      return -1;    }//if  } else if (theStatus == FinalGetValue) {    theFinalReadSize = tTotalCurrAI_Len -      (tInitReadSize + theInterpretedSize + theFinalUpdateSize + 5);  } else if (theStatus == SetValueInterpreted) {    theFinalUpdateSize = tTotalCurrAI_Len -       (tInitReadSize + theInterpretedSize + 5);  } else if (theStatus == SubroutineEnd) {    theSubroutineSize = tTotalCurrAI_Len -      (tInitReadSize + theInterpretedSize +          theFinalUpdateSize + theFinalReadSize + 5);  } else if (theStatus == GetValue) {    theInitialReadSize = tTotalCurrAI_Len - 5;  } else {    setErrorCodeAbort(4116);    return -1;  }  while (theFirstBranch != NULL) {    Uint32 tRelAddress;    Uint32 tLabelAddress = 0;    int     tAddress = -1;    NdbBranch* tNdbBranch = theFirstBranch;    Uint32 tBranchLabel = tNdbBranch->theBranchLabel;    NdbLabel* tNdbLabel = theFirstLabel;    if (tBranchLabel >= theNoOfLabels) {      setErrorCodeAbort(4221);      return -1;    }//if    // Find the label address    while (tNdbLabel != NULL) {      for(tLabelAddress = 0; tLabelAddress<16; tLabelAddress++){	const Uint32 labelNo = tNdbLabel->theLabelNo[tLabelAddress];	if(tBranchLabel == labelNo){	  tAddress = tNdbLabel->theLabelAddress[tLabelAddress];	  break;	}      }            if(tAddress != -1)	break;      tNdbLabel = tNdbLabel->theNext;    }//while    if (tAddress == -1) {//-------------------------------------------------------------------------// We were unable to find any label which the branch refers to. This means// that the application have not programmed the interpreter program correctly.//-------------------------------------------------------------------------      setErrorCodeAbort(4222);      return -1;    }//if    if (tNdbLabel->theSubroutine[tLabelAddress] != tNdbBranch->theSubroutine) {      setErrorCodeAbort(4224);      return -1;    }//if    // Now it is time to update the signal data with the relative branch jump.    if (tAddress < int(tNdbBranch->theBranchAddress)) {      tRelAddress = (tNdbBranch->theBranchAddress - tAddress) << 16;            // Indicate backward jump direction      tRelAddress = tRelAddress + (1 << 31);    } else if (tAddress > int(tNdbBranch->theBranchAddress)) {      tRelAddress = (tAddress - tNdbBranch->theBranchAddress) << 16;    } else {       setErrorCodeAbort(4223);       return -1;    }//if    NdbApiSignal* tSignal = tNdbBranch->theSignal;    Uint32 tReadData = tSignal->readData(tNdbBranch->theSignalAddress);    tSignal->setData((tRelAddress + tReadData), tNdbBranch->theSignalAddress);          theFirstBranch = theFirstBranch->theNext;    theNdb->releaseNdbBranch(tNdbBranch);  }//while  while (theFirstCall != NULL) {    Uint32 tSubroutineCount = 0;    int     tAddress = -1;    NdbSubroutine* tNdbSubroutine;    NdbCall* tNdbCall = theFirstCall;    if (tNdbCall->theSubroutine >= theNoOfSubroutines) {      setErrorCodeAbort(4221);      return -1;    }//if// Find the subroutine address    tNdbSubroutine = theFirstSubroutine;    while (tNdbSubroutine != NULL) {      tSubroutineCount += 16;      if (tNdbCall->theSubroutine < tSubroutineCount) {// Subroutine Found        Uint32 tSubroutineAddress = tNdbCall->theSubroutine - (tSubroutineCount - 16);        tAddress = tNdbSubroutine->theSubroutineAddress[tSubroutineAddress];        break;      }//if      tNdbSubroutine = tNdbSubroutine->theNext;    }//while    if (tAddress == -1) {      setErrorCodeAbort(4222);      return -1;    }//if// Now it is time to update the signal data with the relative branch jump.    NdbApiSignal* tSignal = tNdbCall->theSignal;    Uint32 tReadData = tSignal->readData(tNdbCall->theSignalAddress);    tSignal->setData(((tAddress << 16) + tReadData), tNdbCall->theSignalAddress);          theFirstCall = theFirstCall->theNext;    theNdb->releaseNdbCall(tNdbCall);  }//while    Uint32 tInitialReadSize = theInitialReadSize;  Uint32 tInterpretedSize = theInterpretedSize;  Uint32 tFinalUpdateSize = theFinalUpdateSize;  Uint32 tFinalReadSize   = theFinalReadSize;  Uint32 tSubroutineSize  = theSubroutineSize;  if (theOperationType != OpenScanRequest &&      theOperationType != OpenRangeScanRequest) {    TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend());    tcKeyReq->attrInfo[0] = tInitialReadSize;    tcKeyReq->attrInfo[1] = tInterpretedSize;    tcKeyReq->attrInfo[2] = tFinalUpdateSize;    tcKeyReq->attrInfo[3] = tFinalReadSize;    tcKeyReq->attrInfo[4] = tSubroutineSize;  } else {    // If a scan is defined we use the first ATTRINFO instead of TCKEYREQ.    theFirstATTRINFO->setData(tInitialReadSize, 4);    theFirstATTRINFO->setData(tInterpretedSize, 5);    theFirstATTRINFO->setData(tFinalUpdateSize, 6);    theFirstATTRINFO->setData(tFinalReadSize, 7);    theFirstATTRINFO->setData(tSubroutineSize, 8);    }//if  theReceiver.prepareSend();  return 0;}//NdbOperation::prepareSendInterpreted()intNdbOperation::checkState_TransId(NdbApiSignal* aSignal){  Uint64 tRecTransId, tCurrTransId;  Uint32 tTmp1, tTmp2;  if (theStatus != WaitResponse) {#ifdef NDB_NO_DROPPED_SIGNAL    abort();#endif    return -1;  }//if  tTmp1 = aSignal->readData(2);  tTmp2 = aSignal->readData(3);  tRecTransId = (Uint64)tTmp1 + ((Uint64)tTmp2 << 32);  tCurrTransId = theNdbCon->getTransactionId();  if (tCurrTransId != tRecTransId) {#ifdef NDB_NO_DROPPED_SIGNAL    abort();#endif    return -1;  }//if  return 0;}//NdbOperation::checkState_TransId()/***************************************************************************int receiveTCKEYREF( NdbApiSignal* aSignal)Return Value:   Return 0 : send was succesful.                Return -1: In all other case.   Parameters:     aSignal: the signal object that contains the TCKEYREF signal from TC.Remark:         Handles the reception of the TCKEYREF signal.***************************************************************************/intNdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal){  if (checkState_TransId(aSignal) == -1) {    return -1;  }//if  AbortOption ao = (AbortOption)    (m_abortOption != -1 ? m_abortOption : theNdbCon->m_abortOption);  theReceiver.m_received_result_length = ~0;  theStatus = Finished;  // blobs want this  if (m_abortOption != AO_IgnoreError)  {    theNdbCon->theReturnStatus = NdbTransaction::ReturnFailure;  }  theError.code = aSignal->readData(4);  theNdbCon->setOperationErrorCodeAbort(aSignal->readData(4), ao);  if(theOperationType != ReadRequest || !theSimpleIndicator) // not simple read    return theNdbCon->OpCompleteFailure(ao, m_abortOption != AO_IgnoreError);    /**   * If TCKEYCONF has arrived   *   op has completed (maybe trans has completed)   */  if(theReceiver.m_expected_result_length)  {    return theNdbCon->OpCompleteFailure(AbortOnError);  }    return -1;}voidNdbOperation::handleFailedAI_ElemLen(){  NdbRecAttr* tRecAttr = theReceiver.theFirstRecAttr;  while (tRecAttr != NULL) {    tRecAttr->setNULL();    tRecAttr = tRecAttr->next();  }//while}//NdbOperation::handleFailedAI_ElemLen()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -