📄 ndboperationint.cpp
字号:
intNdbOperation::branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label){ INT_DEBUG(("branch_gt %u %u %u", RegLvalue, RegRvalue, Label)); return branch_reg_reg(Interpreter::BRANCH_GT_REG_REG, RegLvalue, RegRvalue, Label);}intNdbOperation::branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label){ INT_DEBUG(("branch_le %u %u %u", RegLvalue, RegRvalue, Label)); return branch_reg_reg(Interpreter::BRANCH_LE_REG_REG, RegLvalue, RegRvalue, Label);}intNdbOperation::branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label){ INT_DEBUG(("branch_lt %u %u %u", RegLvalue, RegRvalue, Label)); return branch_reg_reg(Interpreter::BRANCH_LT_REG_REG, RegLvalue, RegRvalue, Label);}intNdbOperation::branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label){ INT_DEBUG(("branch_eq %u %u %u", RegLvalue, RegRvalue, Label)); return branch_reg_reg(Interpreter::BRANCH_EQ_REG_REG, RegLvalue, RegRvalue, Label);}intNdbOperation::branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label){ INT_DEBUG(("branch_ne %u %u %u", RegLvalue, RegRvalue, Label)); return branch_reg_reg(Interpreter::BRANCH_NE_REG_REG, RegLvalue, RegRvalue, Label);}intNdbOperation::branch_ne_null(Uint32 RegLvalue, Uint32 Label){ INT_DEBUG(("branch_ne_null %u %u", RegLvalue, Label)); if (intermediate_interpreterCheck() == -1) return -1; if (insertATTRINFO((RegLvalue << 6) + Interpreter::BRANCH_REG_NE_NULL) == -1) return -1; if (insertBranch(Label) == -1) return -1; theErrorLine++; return 0;}intNdbOperation::branch_eq_null(Uint32 RegLvalue, Uint32 Label){ INT_DEBUG(("branch_eq_null %u %u", RegLvalue, Label)); if (intermediate_interpreterCheck() == -1) return -1; if (insertATTRINFO((RegLvalue << 6) + Interpreter::BRANCH_REG_EQ_NULL) == -1) return -1; if (insertBranch(Label) == -1) return -1; theErrorLine++; return 0;}intNdbOperation::branch_label(Uint32 Label){ INT_DEBUG(("branch_label %u", Label)); if (initial_interpreterCheck() == -1) return -1; if (insertATTRINFO(Interpreter::BRANCH) == -1) return -1; if (insertBranch(Label) == -1) return -1; theErrorLine++; return 0;}/************************************************************************************************int NdbOperation::interpret_exit_ok()************************************************************************************************/intNdbOperation::interpret_exit_ok(){ INT_DEBUG(("interpret_exit_ok")); if (initial_interpreterCheck() == -1) return -1; if (insertATTRINFO(Interpreter::EXIT_OK) == -1) return -1; theErrorLine++; return 0;}intNdbOperation::interpret_exit_last_row(){ INT_DEBUG(("interpret_exit_last_row")); if (initial_interpreterCheck() == -1) return -1; if (insertATTRINFO(Interpreter::EXIT_OK_LAST) == -1) return -1; theErrorLine++; return 0;}/************************************************************************************************int NdbOperation::interpret_exit_nok(Uint32 ErrorCode)************************************************************************************************/intNdbOperation::interpret_exit_nok(Uint32 ErrorCode){ INT_DEBUG(("interpret_exit_nok %u", ErrorCode)); if (initial_interpreterCheck() == -1) return -1; if (insertATTRINFO( (ErrorCode << 16) + Interpreter::EXIT_REFUSE) == -1) return -1; theErrorLine++; return 0;}intNdbOperation::interpret_exit_nok(){ INT_DEBUG(("interpret_exit_nok")); Uint32 ErrorCode = 899; if (initial_interpreterCheck() == -1) return -1; if (insertATTRINFO( (ErrorCode << 16) + Interpreter::EXIT_REFUSE) == -1) return -1; theErrorLine++; return 0;}intNdbOperation::call_sub(Uint32 Subroutine){ INT_DEBUG(("call_sub %u", Subroutine)); if (initial_interpreterCheck() == -1) return -1; if (insertATTRINFO( (Subroutine << 16) + Interpreter::CALL) == -1) return -1; if (insertCall(Subroutine) == -1) return -1; theErrorLine++; return 0;}intNdbOperation::ret_sub(){ INT_DEBUG(("ret_sub")); if (theInterpretIndicator != 1) { setErrorCodeAbort(4200); return -1; } if (theStatus == SubroutineExec) { ; // Simply continue with interpretation } else { setErrorCodeAbort(4200); return -1; } if (insertATTRINFO(Interpreter::RETURN) == -1) return -1; theStatus = SubroutineEnd; theErrorLine++; return 0;}intNdbOperation::insertBranch(Uint32 aLabel){ Uint32 tAddress; NdbBranch* tBranch = theNdb->getNdbBranch(); if (tBranch == NULL) goto insertBranch_error1; if (theFirstBranch == NULL) theFirstBranch = tBranch; else theLastBranch->theNext = tBranch; theLastBranch = tBranch; if (theNoOfSubroutines == 0) tAddress = theTotalCurrAI_Len - (theInitialReadSize + 5); else tAddress = theTotalCurrAI_Len - (theInitialReadSize + theInterpretedSize + theFinalUpdateSize + theFinalReadSize + 5); tBranch->theBranchAddress = tAddress; tBranch->theSignal = theCurrentATTRINFO; tBranch->theSignalAddress = theAI_LenInCurrAI; // + 1; theAI_LenInCurrAI has already been updated in tBranch->theSubroutine = theNoOfSubroutines; // insertATTRINFO which was done before insertBranch!! tBranch->theBranchLabel = aLabel; return 0;insertBranch_error1: setErrorCodeAbort(4000); return -1;}intNdbOperation::insertCall(Uint32 aCall){ NdbCall* tCall = theNdb->getNdbCall(); if (tCall == NULL) { setErrorCodeAbort(4000); return -1; } if (theFirstCall == NULL) theFirstCall = tCall; else theLastCall->theNext = tCall; theLastCall = tCall; tCall->theSignal = theCurrentATTRINFO; tCall->theSignalAddress = theAI_LenInCurrAI; tCall->theSubroutine = aCall; return 0;}intNdbOperation::branch_col(Uint32 type, Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ DBUG_ENTER("NdbOperation::branch_col"); DBUG_PRINT("enter", ("type=%u col=%u val=0x%x len=%u label=%u", type, ColId, val, len, Label)); if (val != NULL) DBUG_DUMP("value", (char*)val, len); if (initial_interpreterCheck() == -1) DBUG_RETURN(-1); Interpreter::BinaryCondition c = (Interpreter::BinaryCondition)type; const NdbColumnImpl * col = m_currentTable->getColumn(ColId); if(col == 0){ abort(); } if (val == NULL) len = 0; else { if (! col->getStringType()) { // prevent assert in NdbSqlUtil on length error Uint32 sizeInBytes = col->m_attrSize * col->m_arraySize; if (len != 0 && len != sizeInBytes) { setErrorCodeAbort(4209); DBUG_RETURN(-1); } len = sizeInBytes; } } Uint32 tempData[2000]; if (((UintPtr)val & 3) != 0) { memcpy(tempData, val, len); val = tempData; } if (insertATTRINFO(Interpreter::BranchCol(c, 0, 0, false)) == -1) DBUG_RETURN(-1); if (insertBranch(Label) == -1) DBUG_RETURN(-1); if (insertATTRINFO(Interpreter::BranchCol_2(ColId, len))) DBUG_RETURN(-1); Uint32 len2 = Interpreter::mod4(len); if(len2 == len){ insertATTRINFOloop((Uint32*)val, len2 >> 2); } else { len2 -= 4; insertATTRINFOloop((Uint32*)val, len2 >> 2); Uint32 tmp = 0; for (Uint32 i = 0; i < len-len2; i++) { char* p = (char*)&tmp; p[i] = ((char*)val)[len2+i]; } insertATTRINFO(tmp); } theErrorLine++; DBUG_RETURN(0);}int NdbOperation::branch_col_eq(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ INT_DEBUG(("branch_col_eq %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); return branch_col(Interpreter::EQ, ColId, val, len, nopad, Label);}intNdbOperation::branch_col_ne(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ INT_DEBUG(("branch_col_ne %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); return branch_col(Interpreter::NE, ColId, val, len, nopad, Label);}intNdbOperation::branch_col_lt(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ INT_DEBUG(("branch_col_lt %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); return branch_col(Interpreter::LT, ColId, val, len, nopad, Label);}intNdbOperation::branch_col_le(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ INT_DEBUG(("branch_col_le %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); return branch_col(Interpreter::LE, ColId, val, len, nopad, Label);}intNdbOperation::branch_col_gt(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ INT_DEBUG(("branch_col_gt %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); return branch_col(Interpreter::GT, ColId, val, len, nopad, Label);}intNdbOperation::branch_col_ge(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ INT_DEBUG(("branch_col_ge %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); return branch_col(Interpreter::GE, ColId, val, len, nopad, Label);}intNdbOperation::branch_col_like(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ INT_DEBUG(("branch_col_like %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label)); return branch_col(Interpreter::LIKE, ColId, val, len, nopad, Label);}intNdbOperation::branch_col_notlike(Uint32 ColId, const void * val, Uint32 len, bool nopad, Uint32 Label){ INT_DEBUG(("branch_col_notlike %u %.*s(%u,%d) -> %u", ColId,len,val,len,nopad,Label)); return branch_col(Interpreter::NOT_LIKE, ColId, val, len, nopad, Label);}intNdbOperation::branch_col_null(Uint32 type, Uint32 ColId, Uint32 Label){ if (initial_interpreterCheck() == -1) return -1; if (insertATTRINFO(type) == -1) return -1; if (insertBranch(Label) == -1) return -1; if (insertATTRINFO(Interpreter::BranchCol_2(ColId))) return -1; theErrorLine++; return 0;}intNdbOperation::branch_col_eq_null(Uint32 ColId, Uint32 Label){ INT_DEBUG(("branch_col_eq_null %u -> %u", ColId, Label)); return branch_col_null(Interpreter::BRANCH_ATTR_EQ_NULL, ColId, Label);}intNdbOperation::branch_col_ne_null(Uint32 ColId, Uint32 Label){ INT_DEBUG(("branch_col_ne_null %u -> %u", ColId, Label)); return branch_col_null(Interpreter::BRANCH_ATTR_NE_NULL, ColId, Label);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -