18 #ifndef NdbOperation_H
19 #define NdbOperation_H
21 #include <ndb_types.h>
22 #include "ndbapi_limits.h"
23 #include "NdbError.hpp"
24 #include "NdbReceiver.hpp"
25 #include "NdbDictionary.hpp"
47 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
51 friend class NdbScanReceiver;
70 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
74 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
78 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
82 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
93 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
97 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
101 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
180 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
269 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
319 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
320 int equal(
const char* anAttrName,
const char* aValue, Uint32 len);
322 int equal(
const char* anAttrName,
const char* aValue);
323 int equal(
const char* anAttrName, Int32 aValue);
324 int equal(
const char* anAttrName, Uint32 aValue);
325 int equal(
const char* anAttrName, Int64 aValue);
326 int equal(
const char* anAttrName, Uint64 aValue);
327 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
328 int equal(Uint32 anAttrId,
const char* aValue, Uint32 len);
330 int equal(Uint32 anAttrId,
const char* aValue);
331 int equal(Uint32 anAttrId, Int32 aValue);
332 int equal(Uint32 anAttrId, Uint32 aValue);
333 int equal(Uint32 anAttrId, Int64 aValue);
334 int equal(Uint32 anAttrId, Uint64 aValue);
414 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
415 int setValue(
const char* anAttrName,
const char* aValue, Uint32 len);
417 int setValue(
const char* anAttrName,
const char* aValue);
418 int setValue(
const char* anAttrName, Int32 aValue);
419 int setValue(
const char* anAttrName, Uint32 aValue);
420 int setValue(
const char* anAttrName, Int64 aValue);
421 int setValue(
const char* anAttrName, Uint64 aValue);
422 int setValue(
const char* anAttrName,
float aValue);
423 int setValue(
const char* anAttrName,
double aValue);
424 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
425 int setAnyValue(Uint32 aValue);
426 int setOptimize(Uint32 options);
429 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
430 int setValue(Uint32 anAttrId,
const char* aValue, Uint32 len);
432 int setValue(Uint32 anAttrId,
const char* aValue);
433 int setValue(Uint32 anAttrId, Int32 aValue);
434 int setValue(Uint32 anAttrId, Uint32 aValue);
435 int setValue(Uint32 anAttrId, Int64 aValue);
436 int setValue(Uint32 anAttrId, Uint64 aValue);
437 int setValue(Uint32 anAttrId,
float aValue);
438 int setValue(Uint32 anAttrId,
double aValue);
462 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
485 int incValue(
const char* anAttrName, Uint32 aValue);
486 int incValue(
const char* anAttrName, Uint64 aValue);
487 int incValue(Uint32 anAttrId, Uint32 aValue);
488 int incValue(Uint32 anAttrId, Uint64 aValue);
507 int subValue(
const char* anAttrName, Uint32 aValue);
508 int subValue(
const char* anAttrName, Uint64 aValue);
509 int subValue(Uint32 anAttrId, Uint32 aValue);
510 int subValue(Uint32 anAttrId, Uint64 aValue);
541 int add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
555 int sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
569 int load_const_u64(Uint32 RegDest, Uint64 Constant);
594 int read_attr(
const char* anAttrName, Uint32 RegDest);
607 int write_attr(
const char* anAttrName, Uint32 RegSource);
620 int read_attr(Uint32 anAttrId, Uint32 RegDest);
633 int write_attr(Uint32 anAttrId, Uint32 RegSource);
657 int branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
658 int branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
659 int branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
660 int branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
661 int branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
662 int branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
713 int branch_col_ne_null(Uint32 ColId, Uint32 Label);
728 int branch_col_eq(Uint32 ColId,
const void * val, Uint32 len,
729 bool nopad, Uint32 Label);
730 int branch_col_ne(Uint32 ColId,
const void * val, Uint32 len,
731 bool nopad, Uint32 Label);
732 int branch_col_lt(Uint32 ColId,
const void * val, Uint32 len,
733 bool nopad, Uint32 Label);
734 int branch_col_le(Uint32 ColId,
const void * val, Uint32 len,
735 bool nopad, Uint32 Label);
736 int branch_col_gt(Uint32 ColId,
const void * val, Uint32 len,
737 bool nopad, Uint32 Label);
738 int branch_col_ge(Uint32 ColId,
const void * val, Uint32 len,
739 bool nopad, Uint32 Label);
753 bool nopad, Uint32 Label);
754 int branch_col_notlike(Uint32 ColId,
const void *, Uint32 len,
755 bool nopad, Uint32 Label);
782 bool nopad, Uint32 Label);
783 int branch_col_and_mask_ne_mask(Uint32 ColId,
const void *, Uint32 len,
784 bool nopad, Uint32 Label);
785 int branch_col_and_mask_eq_zero(Uint32 ColId,
const void *, Uint32 len,
786 bool nopad, Uint32 Label);
787 int branch_col_and_mask_ne_zero(Uint32 ColId,
const void *, Uint32 len,
788 bool nopad, Uint32 Label);
811 int interpret_exit_nok(Uint32 ErrorCode);
812 int interpret_exit_nok();
882 #ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
906 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
935 int setAbortOption(AbortOption);
942 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
948 Uint32 getPartitionId()
const;
1034 Uint64 optionsPresent;
1035 enum Flags { OO_ABORTOPTION = 0x01,
1038 OO_PARTITION_ID = 0x08,
1039 OO_INTERPRETED = 0x10,
1041 OO_CUSTOMDATA = 0x40,
1042 OO_LOCKHANDLE = 0x80,
1043 OO_QUEUABLE = 0x100,
1044 OO_NOT_QUEUABLE = 0x200,
1045 OO_DEFERRED_CONSTAINTS = 0x400
1056 Uint32 numExtraGetValues;
1060 Uint32 numExtraSetValues;
1101 void initInterpreter();
1109 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
1113 void* getCustomData()
const {
return m_customData; }
1114 void setCustomData(
void* p) { m_customData = p; }
1127 enum OperationStatus
1161 ExecInterpretedValue,
1165 SetValueInterpreted,
1196 OperationStatus Status();
1198 void Status(OperationStatus);
1203 virtual void release();
1206 void postExecuteRelease();
1209 void setStartIndicator();
1216 const OperationOptions *opts,
1217 const Uint32 sizeOfOptions,
1230 int doSend(
int ProcessorId, Uint32 lastFlag);
1232 Uint64 TransactionId,
1234 virtual void setLastFlag(
NdbApiSignal* signal, Uint32 lastFlag);
1236 int prepareSendInterpreted();
1239 Uint32*& interpretedInfo,
1241 Uint32 stackSpaceEntries,
1242 Uint32*& dynamicSpace);
1244 void freeInterpretedInfo(Uint32*& dynamicSpace);
1250 int buildInterpretedProgramSignals(Uint32 aTC_ConnectPtr,
1252 Uint32 **attrInfoPtr,
1255 Uint32 *interpretedWorkspace,
1257 Uint32 &wordsWritten);
1260 int buildSignalsNdbRecord(Uint32 aTC_ConnectPtr, Uint64 aTransId,
1261 const Uint32 * read_mask);
1264 int prepareSendNdbRecord(AbortOption ao);
1267 Uint32 fillTcKeyReqHdr(
TcKeyReq *tcKeyReq,
1271 int allocAttrInfo();
1272 int insertKEYINFO_NdbRecord(
const char *value,
1274 int insertATTRINFOHdr_NdbRecord(Uint32 attrId,
1276 int insertATTRINFOData_NdbRecord(
const char *value,
1281 int checkMagicNumber(
bool b =
true);
1289 virtual int equal_impl(
const NdbColumnImpl*,
const char* aValue);
1301 int branch_reg_reg(Uint32
type, Uint32, Uint32, Uint32);
1302 int branch_col(Uint32
type, Uint32,
const void *, Uint32, Uint32 Label);
1303 int branch_col_null(Uint32
type, Uint32 col, Uint32 Label);
1307 int getBlobHandlesNdbRecord(
NdbTransaction* aCon,
const Uint32 * mask);
1309 bool checkReadSet,
const Uint32 * mask);
1312 int insertATTRINFO(Uint32 aData);
1313 int insertATTRINFOloop(
const Uint32* aDataPtr, Uint32 aLength);
1315 int insertKEYINFO(
const char* aValue,
1316 Uint32 aStartPosition,
1317 Uint32 aKeyLenInByte);
1318 void reorderKEYINFO();
1320 virtual void setErrorCode(
int aErrorCode)
const;
1321 virtual void setErrorCodeAbort(
int aErrorCode)
const;
1323 bool isNdbRecordOperation();
1325 int initial_interpreterCheck();
1326 int intermediate_interpreterCheck();
1330 int insertCall(Uint32 aCall);
1331 int insertBranch(Uint32 aBranch);
1333 Uint32 ptr2int() {
return theReceiver.getId(); };
1334 Uint32 ptr2int()
const {
return theReceiver.getId(); };
1337 int getKeyFromTCREQ(Uint32* data, Uint32 &
size);
1339 int getLockHandleImpl();
1340 int prepareGetLockHandle();
1341 int prepareGetLockHandleNdbRecord();
1343 virtual void setReadLockMode(LockMode lockMode);
1368 Uint32 theTotalCurrAI_Len;
1370 Uint32 theAI_LenInCurrAI;
1382 Uint32 theNoOfLabels;
1383 Uint32 theNoOfSubroutines;
1385 Uint32* theKEYINFOptr;
1386 Uint32 keyInfoRemain;
1387 Uint32* theATTRINFOptr;
1388 Uint32 attrInfoRemain;
1403 Uint32 theTupleKeyDefined[NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY][3];
1405 Uint32 theTotalNrOfKeyWordInSignal;
1408 Uint32 theTupKeyLen;
1410 Uint8 theNoOfTupKeyLeft;
1413 LockMode theLockMode;
1414 OperationStatus theStatus;
1416 Uint32 theMagicNumber;
1419 Uint32 theDistributionKey;
1421 Uint32 theSubroutineSize;
1422 Uint32 theInitialReadSize;
1423 Uint32 theInterpretedSize;
1424 Uint32 theFinalUpdateSize;
1425 Uint32 theFinalReadSize;
1427 Uint8 theStartIndicator;
1428 Uint8 theCommitIndicator;
1429 Uint8 theSimpleIndicator;
1430 Uint8 theDirtyIndicator;
1431 Uint8 theInterpretIndicator;
1434 Int8 theDistrKeyIndicator_;
1443 OF_USE_ANY_VALUE = 0x2,
1445 OF_DEFERRED_CONSTRAINTS = 0x8
1452 Uint16 m_keyInfoGSN;
1453 Uint16 m_attrInfoGSN;
1470 const char *m_key_row;
1472 Uint32 m_keyinfo_length;
1480 const char *m_attribute_row;
1486 Uint32 m_unused_read_mask[(128+31)>>5];
1491 const SetValueSpec *m_extraSetValues;
1492 Uint32 m_numExtraSetValues;
1501 getVarValue(
const NdbColumnImpl*,
char* aBareValue, Uint16* aLenLoc);
1503 setVarValue(
const NdbColumnImpl*,
const char* aBareValue,
const Uint16& aLen);
1516 Int8 m_noErrorPropagation;
1520 Uint32 repack_read(Uint32 len);
1524 bool m_blob_lock_upgraded;
1533 #ifdef NDB_NO_DROPPED_SIGNAL
1537 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
1541 NdbOperation::checkMagicNumber(
bool b)
1543 #ifndef NDB_NO_DROPPED_SIGNAL
1546 if (theMagicNumber != 0xABCDEF01){
1547 #ifdef NDB_NO_DROPPED_SIGNAL
1557 NdbOperation::setStartIndicator()
1559 theStartIndicator = 1;
1568 return cthis->NdbOperation::getNdbErrorLine();
1575 return theErrorLine;
1588 theNext = aNdbOperation;
1599 NdbOperation::next()
1606 NdbOperation::next()
const
1613 NdbOperation::getFirstRecAttr()
const
1615 return theReceiver.theFirstRecAttr;
1639 NdbOperation::OperationStatus
1640 NdbOperation::Status()
1654 NdbOperation::Status( OperationStatus aStatus )
1656 theStatus = aStatus;
1669 theNdbCon = aNdbCon;
1678 return equal(anAttrName, aValue);
1685 return equal(anAttrName, (
const char*)&aPar, (Uint32)4);
1692 return equal(anAttrName, (
const char*)&aPar, (Uint32)4);
1699 return equal(anAttrName, (
const char*)&aPar, (Uint32)8);
1706 return equal(anAttrName, (
const char*)&aPar, (Uint32)8);
1715 return equal(anAttrId, aValue);
1722 return equal(anAttrId, (
const char*)&aPar, (Uint32)4);
1729 return equal(anAttrId, (
const char*)&aPar, (Uint32)4);
1736 return equal(anAttrId, (
const char*)&aPar, (Uint32)8);
1743 return equal(anAttrId, (
const char*)&aPar, (Uint32)8);
1752 return setValue(anAttrName, aValue);
1759 return setValue(anAttrName, (
const char*)&aPar, (Uint32)4);
1766 return setValue(anAttrName, (
const char*)&aPar, (Uint32)4);
1773 return setValue(anAttrName, (
const char*)&aPar, (Uint32)8);
1780 return setValue(anAttrName, (
const char*)&aPar, (Uint32)8);
1787 return setValue(anAttrName, (
const char*)&aPar, (Uint32)4);
1794 return setValue(anAttrName, (
const char*)&aPar, (Uint32)8);
1810 return setValue(anAttrId, (
const char*)&aPar, (Uint32)4);
1817 return setValue(anAttrId, (
const char*)&aPar, (Uint32)4);
1824 return setValue(anAttrId, (
const char*)&aPar, (Uint32)8);
1831 return setValue(anAttrId, (
const char*)&aPar, (Uint32)8);
1838 return setValue(anAttrId, (
char*)&aPar, (Uint32)4);
1845 return setValue(anAttrId, (
const char*)&aPar, (Uint32)8);