📄 ndboperationint.cpp
字号:
if (insertATTRINFO( Interpreter::Read(tAttrId, 6)) == -1) goto incValue_error1;// Load aValue into register 7 if (insertATTRINFO( Interpreter::LoadConst64(7)) == -1) goto incValue_error1; if (insertATTRINFOloop((Uint32*)&aValue, 2) == -1) goto incValue_error1; // Add register 6 and 7 and put result in register 7 if (insertATTRINFO( Interpreter::Add(7, 6, 7)) == -1) goto incValue_error1; if (insertATTRINFO( Interpreter::Write(tAttrId, 7)) == -1) goto incValue_error1; theErrorLine++; return 0; incValue_error1: return -1;}/***************************************************************************** * int subValue(const char* anAttrName, char* aValue, Uint64 aValue) * * Return Value: Return 0 : incValue was succesful. * Return -1: In all other case. * Parameters: anAttrName : Attribute name where the attribute value will * be save. * aValue : The constant to increment the attribute value with. ******************************************************************************/intNdbOperation::subValue(const NdbColumnImpl* tNdbColumnImpl, Uint64 aValue){ INT_DEBUG(("subValue64 %d %llu", tNdbColumnImpl->m_attrId, aValue)); int tAttrId; tAttrId = incCheck(tNdbColumnImpl); if (tAttrId == -1) goto subValue_error1;// Load Attribute into register 6 if (insertATTRINFO( Interpreter::Read(6, tAttrId)) == -1) goto subValue_error1;// Load aValue into register 7 if (insertATTRINFO( Interpreter::LoadConst64(7)) == -1) goto subValue_error1; if (insertATTRINFOloop((Uint32*)&aValue, 2) == -1) goto subValue_error1;// Subtract register 6 and 7 and put result in register 7 if (insertATTRINFO( Interpreter::Sub(7, 6, 7)) == -1) goto subValue_error1; if (insertATTRINFO( Interpreter::Write(tAttrId, 7)) == -1) goto subValue_error1; theErrorLine++; return 0; subValue_error1: return -1;}/***************************************************************************** * int NdbOperation::def_label() *****************************************************************************/intNdbOperation::def_label(int tLabelNo){ INT_DEBUG(("def_label %d", tLabelNo)); Uint32 tLabelIndex; if (labelCheck() == -1) return -1; tLabelIndex = theNoOfLabels - ((theNoOfLabels >> 4) << 4); if (tLabelIndex == 0) { NdbLabel* tNdbLabel = theNdb->getNdbLabel(); if (tNdbLabel == NULL) { setErrorCodeAbort(4000); return -1; } if (theFirstLabel == NULL) theFirstLabel = tNdbLabel; else theLastLabel->theNext = tNdbLabel; theLastLabel = tNdbLabel; tNdbLabel->theNext = NULL; } /** * Here we set the address that the label should point to (jump address), * the first 5 words are excluded since they are length specifications and * not part of the data. * We need to add 1 to the current ATTRINFO length since the last inserted * item is not where we want to jump to. * Later on we will update the branch items with this address, this is done in * the NdbOperation::prepareSendInterpreted method. */ theLastLabel->theLabelNo[tLabelIndex] = tLabelNo; theLastLabel->theLabelAddress[tLabelIndex] = (theTotalCurrAI_Len + 1) - (theInitialReadSize + 5); theLastLabel->theSubroutine[tLabelIndex] = theNoOfSubroutines; theNoOfLabels++; theErrorLine++; return (theNoOfLabels - 1);}/************************************************************************************************int NdbOperation::def_subroutine()************************************************************************************************/intNdbOperation::def_subroutine(int tSubNo){ INT_DEBUG(("def_subroutine %d", tSubNo)); Uint32 tSubroutineIndex; if (theInterpretIndicator != 1) { setErrorCodeAbort(4200); return -1; } if (int(theNoOfSubroutines) != tSubNo) { setErrorCodeAbort(4227); return -1; } if (theStatus == FinalGetValue) { theFinalReadSize = theTotalCurrAI_Len - (theInitialReadSize + theInterpretedSize + theFinalUpdateSize + 5); } else if (theStatus == SubroutineEnd) { ; // Correct Status, last call was ret_sub() } else if (theStatus == ExecInterpretedValue) { if (insertATTRINFO(Interpreter::EXIT_OK) == -1) return -1; theInterpretedSize = theTotalCurrAI_Len - (theInitialReadSize + 5); } else if (theStatus == SetValueInterpreted) { theFinalUpdateSize = theTotalCurrAI_Len - (theInitialReadSize + theInterpretedSize + 5); } else if (theStatus == GetValue) { theInitialReadSize = theTotalCurrAI_Len - 5; } else { setErrorCodeAbort(4200); return -1; } theStatus = SubroutineExec; tSubroutineIndex = theNoOfSubroutines - ((theNoOfSubroutines >> 4) << 4); if (tSubroutineIndex == 0) { NdbSubroutine* tNdbSubroutine = theNdb->getNdbSubroutine(); if (tNdbSubroutine == NULL) { setErrorCodeAbort(4000); return -1; } if (theFirstSubroutine == NULL) theFirstSubroutine = tNdbSubroutine; else theLastSubroutine->theNext = tNdbSubroutine; theLastSubroutine = tNdbSubroutine; tNdbSubroutine->theNext = NULL; } theLastSubroutine->theSubroutineAddress[tSubroutineIndex] = theTotalCurrAI_Len - (theInitialReadSize + theInterpretedSize + theFinalUpdateSize + theFinalReadSize); theNoOfSubroutines++; theErrorLine++; return (theNoOfSubroutines - 1);}/************************************************************************************************int NdbOperation::add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest)************************************************************************************************/intNdbOperation::add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest){ INT_DEBUG(("add_reg %u %u %u", RegSource1, RegSource2, RegDest)); if (intermediate_interpreterCheck() == -1) return -1; if (RegSource1 >= 8) { setErrorCodeAbort(4229); return -1; } if (RegSource2 >= 8) { setErrorCodeAbort(4229); return -1; } if (RegDest >= 8) { setErrorCodeAbort(4229); return -1; } if (insertATTRINFO( Interpreter::Add(RegDest, RegSource1, RegSource2)) == -1) return -1; theErrorLine++; return 0;}/************************************************************************************************int NdbOperation::sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest)************************************************************************************************/intNdbOperation::sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest){ INT_DEBUG(("sub_reg %u %u %u", RegSource1, RegSource2, RegDest)); if (intermediate_interpreterCheck() == -1) return -1; if (RegSource1 >= 8) { setErrorCodeAbort(4229); return -1; } if (RegSource2 >= 8) { setErrorCodeAbort(4229); return -1; } if (RegDest >= 8) { setErrorCodeAbort(4229); return -1; } if (insertATTRINFO( Interpreter::Sub(RegDest, RegSource1, RegSource2)) == -1) return -1; theErrorLine++; return 0;}/************************************************************************************************int NdbOperation::load_const_u32(Uint32 RegDest, Uint32 Constant)************************************************************************************************/intNdbOperation::load_const_u32(Uint32 RegDest, Uint32 Constant){ INT_DEBUG(("load_const_u32 %u %u", RegDest, Constant)); if (initial_interpreterCheck() == -1) goto l_u32_error1; if (RegDest >= 8) goto l_u32_error2; if (insertATTRINFO( Interpreter::LoadConst32(RegDest)) == -1) goto l_u32_error1; if (insertATTRINFO(Constant) == -1) goto l_u32_error1; theErrorLine++; return 0; l_u32_error1: return -1; l_u32_error2: setErrorCodeAbort(4229); return -1;}/************************************************************************************************int NdbOperation::load_const_u64(Uint32 RegDest, Uint64 Constant)************************************************************************************************/intNdbOperation::load_const_u64(Uint32 RegDest, Uint64 Constant){ INT_DEBUG(("load_const_u64 %u %llu", RegDest, Constant)); if (initial_interpreterCheck() == -1) return -1; if (RegDest >= 8) { setErrorCodeAbort(4229); return -1; } // 64 bit value if (insertATTRINFO( Interpreter::LoadConst64(RegDest)) == -1) return -1; if (insertATTRINFOloop((Uint32*)&Constant, 2) == -1) return -1; theErrorLine++; return 0;}/************************************************************************************************int NdbOperation::load_const_null(Uint32 RegDest)************************************************************************************************/intNdbOperation::load_const_null(Uint32 RegDest){ INT_DEBUG(("load_const_null %u", RegDest)); if (initial_interpreterCheck() == -1) return -1; if (RegDest >= 8) { setErrorCodeAbort(4229); return -1; } if (insertATTRINFO( Interpreter::LOAD_CONST_NULL) == -1) return -1; theErrorLine++; return 0;}/************************************************************************************************int NdbOperation::read_attr(const char* anAttrName, Uint32 RegDest)************************************************************************************************/intNdbOperation::read_attr(const NdbColumnImpl* anAttrObject, Uint32 RegDest){ INT_DEBUG(("read_attr %d %u", anAttrObject->m_attrId, RegDest)); if (initial_interpreterCheck() == -1) return -1; int tAttrId = read_attrCheck(anAttrObject); if (tAttrId == -1) goto read_attr_error1; if (RegDest >= 8) goto read_attr_error2; if (insertATTRINFO( Interpreter::Read(tAttrId, RegDest)) != -1) { return 0; theErrorLine++; }//if return -1;read_attr_error1: return -1;read_attr_error2: setErrorCodeAbort(4229); return -1;}/************************************************************************************************int NdbOperation::write_attr(const char* anAttrName, Uint32 RegSource)************************************************************************************************/intNdbOperation::write_attr(const NdbColumnImpl* anAttrObject, Uint32 RegSource){ INT_DEBUG(("write_attr %d %u", anAttrObject->m_attrId, RegSource)); int tAttrId = write_attrCheck(anAttrObject); if (tAttrId == -1) return -1; if (insertATTRINFO( Interpreter::Write(tAttrId, RegSource)) == -1) return -1; theErrorLine++; return 0;}intNdbOperation::branch_reg_reg(Uint32 type, Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label){ if (intermediate_interpreterCheck() == -1) return -1; if (insertATTRINFO(Interpreter::Branch(type, RegLvalue, RegRvalue)) == -1) return -1; if (insertBranch(Label) == -1) return -1; theErrorLine++; return 0;}intNdbOperation::branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label){ INT_DEBUG(("branch_ge %u %u %u", RegLvalue, RegRvalue, Label)); return branch_reg_reg(Interpreter::BRANCH_GE_REG_REG, RegLvalue, RegRvalue, Label);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -