📄 dbtupexecquery.cpp
字号:
// While reading an attribute we allow the attribute to be an array // as long as it fits in the 64 bits of the register. /* ---------------------------------------------------------------- */ { Uint32 theAttrinfo = theInstruction; int TnoDataRW= readAttributes(pagePtr, TupHeadOffset, &theAttrinfo, (Uint32)1, &TregMemBuffer[theRegister], (Uint32)3, false); if (TnoDataRW == 2) { /* ------------------------------------------------------------- */ // Two words read means that we get the instruction plus one 32 // word read. Thus we set the register to be a 32 bit register. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0x50; * (Int64*)(TregMemBuffer+theRegister+2) = TregMemBuffer[theRegister+1]; } else if (TnoDataRW == 3) { /* ------------------------------------------------------------- */ // Three words read means that we get the instruction plus two // 32 words read. Thus we set the register to be a 64 bit register. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0x60; TregMemBuffer[theRegister+3] = TregMemBuffer[theRegister+2]; TregMemBuffer[theRegister+2] = TregMemBuffer[theRegister+1]; } else if (TnoDataRW == 1) { /* ------------------------------------------------------------- */ // One word read means that we must have read a NULL value. We set // the register to indicate a NULL value. /* ------------------------------------------------------------- */ TregMemBuffer[theRegister] = 0; TregMemBuffer[theRegister + 2] = 0; TregMemBuffer[theRegister + 3] = 0; } else if (TnoDataRW == -1) { jam(); tupkeyErrorLab(signal); return -1; } else { /* ------------------------------------------------------------- */ // Any other return value from the read attribute here is not // allowed and will lead to a system crash. /* ------------------------------------------------------------- */ ndbrequire(false); }//if break; } case Interpreter::WRITE_ATTR_FROM_REG: jam(); { Uint32 TattrId = theInstruction >> 16; Uint32 TattrDescrIndex = tabptr.p->tabDescriptor + (TattrId << ZAD_LOG_SIZE); Uint32 TattrDesc1 = tableDescriptor[TattrDescrIndex].tabDescr; Uint32 TregType = TregMemBuffer[theRegister]; /* --------------------------------------------------------------- */ // Calculate the number of words of this attribute. // We allow writes into arrays as long as they fit into the 64 bit // register size. /* --------------------------------------------------------------- */ Uint32 TattrNoOfWords = AttributeDescriptor::getSizeInWords(TattrDesc1); Uint32 Toptype = operPtr.p->optype; Uint32 TdataForUpdate[3]; Uint32 Tlen; AttributeHeader& ah = AttributeHeader::init(&TdataForUpdate[0], TattrId, TattrNoOfWords); TdataForUpdate[1] = TregMemBuffer[theRegister + 2]; TdataForUpdate[2] = TregMemBuffer[theRegister + 3]; Tlen = TattrNoOfWords + 1; if (Toptype == ZUPDATE) { if (TattrNoOfWords <= 2) { if (TregType == 0) { /* --------------------------------------------------------- */ // Write a NULL value into the attribute /* --------------------------------------------------------- */ ah.setNULL(); Tlen = 1; }//if int TnoDataRW= updateAttributes(pagePtr, TupHeadOffset, &TdataForUpdate[0], Tlen); if (TnoDataRW != -1) { /* --------------------------------------------------------- */ // Write the written data also into the log buffer so that it // will be logged. /* --------------------------------------------------------- */ logMemory[TdataWritten + 0] = TdataForUpdate[0]; logMemory[TdataWritten + 1] = TdataForUpdate[1]; logMemory[TdataWritten + 2] = TdataForUpdate[2]; TdataWritten += Tlen; } else { tupkeyErrorLab(signal); return -1; }//if } else { return TUPKEY_abort(signal, 15); }//if } else { return TUPKEY_abort(signal, 16); }//if break; } case Interpreter::LOAD_CONST_NULL: jam(); TregMemBuffer[theRegister] = 0; /* NULL INDICATOR */ break; case Interpreter::LOAD_CONST16: jam(); TregMemBuffer[theRegister] = 0x50; /* 32 BIT UNSIGNED CONSTANT */ * (Int64*)(TregMemBuffer+theRegister+2) = theInstruction >> 16; break; case Interpreter::LOAD_CONST32: jam(); TregMemBuffer[theRegister] = 0x50; /* 32 BIT UNSIGNED CONSTANT */ * (Int64*)(TregMemBuffer+theRegister+2) = * (TcurrentProgram+TprogramCounter); TprogramCounter++; break; case Interpreter::LOAD_CONST64: jam(); TregMemBuffer[theRegister] = 0x60; /* 64 BIT UNSIGNED CONSTANT */ TregMemBuffer[theRegister + 2 ] = * (TcurrentProgram + TprogramCounter++); TregMemBuffer[theRegister + 3 ] = * (TcurrentProgram + TprogramCounter++); break; case Interpreter::ADD_REG_REG: jam(); { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TdestRegister = Interpreter::getReg3(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); Uint32 TleftType = TregMemBuffer[theRegister]; Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TleftType | TrightType) != 0) { Uint64 Tdest0 = Tleft0 + Tright0; * (Int64*)(TregMemBuffer+TdestRegister+2) = Tdest0; TregMemBuffer[TdestRegister] = 0x60; } else { return TUPKEY_abort(signal, 20); } break; } case Interpreter::SUB_REG_REG: jam(); { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TdestRegister = Interpreter::getReg3(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); Uint32 TleftType = TregMemBuffer[theRegister]; Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TleftType | TrightType) != 0) { Int64 Tdest0 = Tleft0 - Tright0; * (Int64*)(TregMemBuffer+TdestRegister+2) = Tdest0; TregMemBuffer[TdestRegister] = 0x60; } else { return TUPKEY_abort(signal, 20); } break; } case Interpreter::BRANCH: TprogramCounter = brancher(theInstruction, TprogramCounter); break; case Interpreter::BRANCH_REG_EQ_NULL: if (TregMemBuffer[theRegister] != 0) { jam(); continue; } else { jam(); TprogramCounter = brancher(theInstruction, TprogramCounter); }//if break; case Interpreter::BRANCH_REG_NE_NULL: if (TregMemBuffer[theRegister] == 0) { jam(); continue; } else { jam(); TprogramCounter = brancher(theInstruction, TprogramCounter); }//if break; case Interpreter::BRANCH_EQ_REG_REG: { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TleftType = TregMemBuffer[theRegister]; Uint32 Tleft0 = TregMemBuffer[theRegister + 2]; Uint32 Tleft1 = TregMemBuffer[theRegister + 3]; Uint32 TrightType = TregMemBuffer[TrightRegister]; Uint32 Tright0 = TregMemBuffer[TrightRegister + 2]; Uint32 Tright1 = TregMemBuffer[TrightRegister + 3]; if ((TrightType | TleftType) != 0) { jam(); if ((Tleft0 == Tright0) && (Tleft1 == Tright1)) { TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { return TUPKEY_abort(signal, 23); }//if break; } case Interpreter::BRANCH_NE_REG_REG: { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TleftType = TregMemBuffer[theRegister]; Uint32 Tleft0 = TregMemBuffer[theRegister + 2]; Uint32 Tleft1 = TregMemBuffer[theRegister + 3]; Uint32 TrightType = TregMemBuffer[TrightRegister]; Uint32 Tright0 = TregMemBuffer[TrightRegister + 2]; Uint32 Tright1 = TregMemBuffer[TrightRegister + 3]; if ((TrightType | TleftType) != 0) { jam(); if ((Tleft0 != Tright0) || (Tleft1 != Tright1)) { TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { return TUPKEY_abort(signal, 24); }//if break; } case Interpreter::BRANCH_LT_REG_REG: { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); Uint32 TleftType = TregMemBuffer[theRegister]; Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TrightType | TleftType) != 0) { jam(); if (Tleft0 < Tright0) { TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { return TUPKEY_abort(signal, 24); }//if break; } case Interpreter::BRANCH_LE_REG_REG: { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); Uint32 TleftType = TregMemBuffer[theRegister]; Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TrightType | TleftType) != 0) { jam(); if (Tleft0 <= Tright0) { TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { return TUPKEY_abort(signal, 26); }//if break; } case Interpreter::BRANCH_GT_REG_REG: { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); Uint32 TleftType = TregMemBuffer[theRegister]; Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TrightType | TleftType) != 0) { jam(); if (Tleft0 > Tright0){ TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { return TUPKEY_abort(signal, 27); }//if break; } case Interpreter::BRANCH_GE_REG_REG: { Uint32 TrightRegister = Interpreter::getReg2(theInstruction) << 2; Uint32 TrightType = TregMemBuffer[TrightRegister]; Int64 Tright0 = * (Int64*)(TregMemBuffer + TrightRegister + 2); Uint32 TleftType = TregMemBuffer[theRegister]; Int64 Tleft0 = * (Int64*)(TregMemBuffer + theRegister + 2); if ((TrightType | TleftType) != 0) { jam(); if (Tleft0 >= Tright0){ TprogramCounter = brancher(theInstruction, TprogramCounter); }//if } else { return TUPKEY_abort(signal, 28); }//if break; } case Interpreter::BRANCH_ATTR_OP_ARG:{ jam(); Uint32 cond = Interpreter::getBinaryCondition(theInstruction); Uint32 ins2 = TcurrentProgram[TprogramCounter]; Uint32 attrId = Interpreter::getBranchCol_AttrId(ins2) << 16; Uint32 argLen = Interpreter::getBranchCol_Len(ins2); if(tmpHabitant != attrId){ Int32 TnoDataR = readAttributes(pagePtr, TupHeadOffset, &attrId, 1, tmpArea, tmpAreaSz, false); if (TnoDataR == -1) { jam(); tupkeyErrorLab(signal); return -1; } tmpHabitant = attrId; } // get type attrId >>= 16; Uint32 TattrDescrIndex = tabptr.p->tabDescriptor + (attrId << ZAD_LOG_SIZE); Uint32 TattrDesc1 = tableDescriptor[TattrDescrIndex].tabDescr; Uint32 TattrDesc2 = tableDescriptor[TattrDescrIndex+1].tabDescr; Uint32 typeId = AttributeDe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -