📄 ndbtransaction.cpp
字号:
{ tOp->m_currentTable = table; } // Mark that this really an NdbIndexScanOperation tOp->m_type = NdbOperation::OrderedIndexScan; return tOp; } else { setOperationErrorCodeAbort(4271); return NULL; }//if } setOperationErrorCodeAbort(4114); return NULL;}//NdbTransaction::getNdbIndexScanOperation()NdbIndexScanOperation* NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index){ if (index) { const NdbDictionary::Table *table= theNdb->theDictionary->getTable(index->getTable()); if (table) return getNdbIndexScanOperation(index, table); setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code); return NULL; } setOperationErrorCodeAbort(4271); return NULL;}NdbIndexScanOperation* NdbTransaction::getNdbIndexScanOperation(const NdbDictionary::Index * index, const NdbDictionary::Table * table){ if (index && table) return getNdbIndexScanOperation(& NdbIndexImpl::getImpl(*index), & NdbTableImpl::getImpl(*table)); setOperationErrorCodeAbort(4271); return NULL;}//NdbTransaction::getNdbIndexScanOperation()/*****************************************************************************NdbScanOperation* getNdbScanOperation(int aTableId);Return Value Return a pointer to a NdbScanOperation object if getNdbScanOperation was succesful. Return NULL: In all other case. Parameters: tableId : Id of the database table beeing deleted.Remark: Get an operation from NdbScanOperation object idlelist and get the NdbTransaction object who was fetch by startTransaction pointing to this operation getOperation will set the theTableId in the NdbScanOperation object, synchronous.*****************************************************************************/NdbIndexScanOperation*NdbTransaction::getNdbScanOperation(const NdbTableImpl * tab){ NdbIndexScanOperation* tOp; tOp = theNdb->getScanOperation(); if (tOp == NULL) goto getNdbOp_error1; if (tOp->init(tab, this) != -1) { define_scan_op(tOp); // Mark that this NdbIndexScanOperation is used as NdbScanOperation tOp->m_type = NdbOperation::TableScan; return tOp; } else { theNdb->releaseScanOperation(tOp); }//if return NULL;getNdbOp_error1: setOperationErrorCodeAbort(4000); return NULL;}//NdbTransaction::getNdbScanOperation()voidNdbTransaction::remove_list(NdbOperation*& list, NdbOperation* op){ NdbOperation* tmp= list; if(tmp == op) list = op->next(); else { while(tmp && tmp->next() != op) tmp = tmp->next(); if(tmp) tmp->next(op->next()); } op->next(NULL);}voidNdbTransaction::define_scan_op(NdbIndexScanOperation * tOp){ // Link scan operation into list of cursor operations if (m_theLastScanOperation == NULL) m_theFirstScanOperation = m_theLastScanOperation = tOp; else { m_theLastScanOperation->next(tOp); m_theLastScanOperation = tOp; } tOp->next(NULL);}NdbScanOperation* NdbTransaction::getNdbScanOperation(const NdbDictionary::Table * table){ if (table) return getNdbScanOperation(& NdbTableImpl::getImpl(*table)); else return NULL;}//NdbTransaction::getNdbScanOperation()// IndexOperation/*****************************************************************************NdbIndexOperation* getNdbIndexOperation(const char* anIndexName, const char* aTableName);Return Value Return a pointer to a NdbOperation object if getNdbIndexOperation was succesful. Return NULL : In all other case. Parameters: aTableName : Name of the database table. Remark: Get an operation from NdbIndexOperation idlelist and get the NdbTransaction object who was fetch by startTransaction pointing to this operation getOperation will set the theTableId in the NdbIndexOperation object.synchronous******************************************************************************/NdbIndexOperation*NdbTransaction::getNdbIndexOperation(const char* anIndexName, const char* aTableName){ if (theCommitStatus == Started) { NdbTableImpl * table = theNdb->theDictionary->getTable(aTableName); NdbIndexImpl * index; if (table == 0) { setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code); return NULL; } if (table->m_frm.get_data()) { // This unique index is defined from SQL level static const char* uniqueSuffix= "$unique"; BaseString uniqueIndexName(anIndexName); uniqueIndexName.append(uniqueSuffix); index = theNdb->theDictionary->getIndex(uniqueIndexName.c_str(), aTableName); } else index = theNdb->theDictionary->getIndex(anIndexName, aTableName); if(table != 0 && index != 0){ return getNdbIndexOperation(index, table); } if(index == 0){ setOperationErrorCodeAbort(4243); return NULL; } setOperationErrorCodeAbort(4243); return NULL; } setOperationErrorCodeAbort(4114); return 0;}//NdbTransaction::getNdbIndexOperation()/*****************************************************************************NdbIndexOperation* getNdbIndexOperation(int anIndexId, int aTableId);Return Value Return a pointer to a NdbIndexOperation object if getNdbIndexOperation was succesful. Return NULL: In all other case. Parameters: tableId : Id of the database table beeing deleted.Remark: Get an operation from NdbIndexOperation object idlelist and get the NdbTransaction object who was fetch by startTransaction pointing to this operation getOperation will set the theTableId in the NdbIndexOperation object, synchronous.*****************************************************************************/NdbIndexOperation*NdbTransaction::getNdbIndexOperation(const NdbIndexImpl * anIndex, const NdbTableImpl * aTable, NdbOperation* aNextOp){ NdbIndexOperation* tOp; tOp = theNdb->getIndexOperation(); if (tOp == NULL) goto getNdbOp_error1; if (aNextOp == NULL) { if (theLastOpInList != NULL) { theLastOpInList->next(tOp); theLastOpInList = tOp; } else { theLastOpInList = tOp; theFirstOpInList = tOp; }//if tOp->next(NULL); } else { // add before the given op if (theFirstOpInList == aNextOp) { theFirstOpInList = tOp; } else { NdbOperation* aLoopOp = theFirstOpInList; while (aLoopOp != NULL && aLoopOp->next() != aNextOp) aLoopOp = aLoopOp->next(); assert(aLoopOp != NULL); aLoopOp->next(tOp); } tOp->next(aNextOp); } if (tOp->indxInit(anIndex, aTable, this)!= -1) { return tOp; } else { theNdb->releaseOperation(tOp); }//if return NULL; getNdbOp_error1: setOperationErrorCodeAbort(4000); return NULL;}//NdbTransaction::getNdbIndexOperation()NdbIndexOperation* NdbTransaction::getNdbIndexOperation(const NdbDictionary::Index * index){ if (index) { const NdbDictionary::Table *table= theNdb->theDictionary->getTable(index->getTable()); if (table) return getNdbIndexOperation(index, table); setOperationErrorCodeAbort(theNdb->theDictionary->getNdbError().code); return NULL; } setOperationErrorCodeAbort(4271); return NULL;}NdbIndexOperation* NdbTransaction::getNdbIndexOperation(const NdbDictionary::Index * index, const NdbDictionary::Table * table){ if (index && table) return getNdbIndexOperation(& NdbIndexImpl::getImpl(*index), & NdbTableImpl::getImpl(*table)); setOperationErrorCodeAbort(4271); return NULL;}//NdbTransaction::getNdbIndexOperation()/*******************************************************************************int receiveDIHNDBTAMPER(NdbApiSignal* aSignal)Return Value: Return 0 : receiveDIHNDBTAMPER was successful. Return -1: In all other case.Parameters: aSignal: The signal object pointer.Remark: Sets theRestartGCI in the NDB object. *******************************************************************************/int NdbTransaction::receiveDIHNDBTAMPER(NdbApiSignal* aSignal){ if (theStatus != Connecting) { return -1; } else { theNdb->RestartGCI((Uint32)aSignal->readData(2)); theStatus = Connected; }//if return 0; }//NdbTransaction::receiveDIHNDBTAMPER()/*******************************************************************************int receiveTCSEIZECONF(NdbApiSignal* aSignal);Return Value: Return 0 : receiveTCSEIZECONF was successful. Return -1: In all other case.Parameters: aSignal: The signal object pointer.Remark: Sets TC Connect pointer at reception of TCSEIZECONF. *******************************************************************************/int NdbTransaction::receiveTCSEIZECONF(NdbApiSignal* aSignal){ if (theStatus != Connecting) { return -1; } else { theTCConPtr = (Uint32)aSignal->readData(2); theStatus = Connected; } return 0;}//NdbTransaction::receiveTCSEIZECONF()/*******************************************************************************int receiveTCSEIZEREF(NdbApiSignal* aSignal);Return Value: Return 0 : receiveTCSEIZEREF was successful. Return -1: In all other case.Parameters: aSignal: The signal object pointer.Remark: Sets TC Connect pointer. *******************************************************************************/int NdbTransaction::receiveTCSEIZEREF(NdbApiSignal* aSignal){ DBUG_ENTER("NdbTransaction::receiveTCSEIZEREF"); if (theStatus != Connecting) { DBUG_RETURN(-1); } else { theStatus = ConnectFailure; theNdb->theError.code = aSignal->readData(2); DBUG_PRINT("info",("error code %d, %s", theNdb->getNdbError().code, theNdb->getNdbError().message)); DBUG_RETURN(0); }}//NdbTransaction::receiveTCSEIZEREF()/*******************************************************************************int receiveTCRELEASECONF(NdbApiSignal* aSignal);Return Value: Return 0 : receiveTCRELEASECONF was successful. Return -1: In all other case.Parameters: aSignal: The signal object pointer.Remark: DisConnect TC Connect pointer to NDBAPI. *******************************************************************************/int NdbTransaction::receiveTCRELEASECONF(NdbApiSignal* aSignal){ if (theStatus != DisConnecting) { return -1; } else { theStatus = NotConnected; } return 0;}//NdbTransaction::receiveTCRELEASECONF()/*******************************************************************************int receiveTCRELEASEREF(NdbApiSignal* aSignal);Return Value: Return 0 : receiveTCRELEASEREF was successful. Return -1: In all other case.Parameters: aSignal: The signal object pointer.Remark: DisConnect TC Connect pointer to NDBAPI Failure. *******************************************************************************/int NdbTransaction::receiveTCRELEASEREF(NdbApiSignal* aSignal){ if (theStatus != DisConnecting) { return -1; } else { theStatus = ConnectFailure; theNdb->theError.code = aSignal->readData(2); return 0; }//if}//NdbTransaction::receiveTCRELEASEREF()/******************************************************************************int receiveTC_COMMITCONF(NdbApiSignal* aSignal);Return Value: Return 0 : receiveTC_COMMITCONF was successful. Return -1: In all other case.Parameters: aSignal: The signal object pointer.Remark: ******************************************************************************/int NdbTransaction::receiveTC_COMMITCONF(const TcCommitConf * commitConf){ if(checkState_TransId(&commitConf->transId1)){ theCommitStatus = Committed; theCompletionStatus = CompletedSuccess; theGlobalCheckpointId = commitConf->gci; return 0; } else {#ifdef NDB_NO_DROPPED_SIGNAL abort();#endif } return -1;}//NdbTransaction::receiveTC_COMMITCONF()/******************************************************************************int receiveTC_COMMITREF(NdbApiSignal* aSignal);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -