MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbOperation Class Reference

Class of operations for use in transactions. More...

#include <NdbOperation.hpp>

Inheritance diagram for NdbOperation:
Collaboration diagram for NdbOperation:

Classes

struct  GetValueSpec
struct  OperationOptions
struct  SetValueSpec

Public Types

enum  OperationType {
  ReadRequest = 0, UpdateRequest = 1, InsertRequest = 2, DeleteRequest = 3,
  WriteRequest = 4, ReadExclusive = 5, RefreshRequest = 6, UnlockRequest = 7,
  OpenScanRequest, OpenRangeScanRequest, NotDefined2, NotDefined
}

Public Member Functions

LockMode getLockMode () const
AbortOption getAbortOption () const
int setAbortOption (AbortOption)
virtual NdbTransactiongetNdbTransaction () const
void setPartitionId (Uint32 id)
Uint32 getPartitionId () const
const NdbLockHandlegetLockHandle () const
const NdbLockHandlegetLockHandle ()
const NdbOperationnext () const
const NdbRecAttrgetFirstRecAttr () const
void * getCustomData () const
void setCustomData (void *p)
Define Interpreted Program Operation Type
virtual int interpretedUpdateTuple ()
virtual int interpretedDeleteTuple ()
Specify Search Conditions
int equal (const char *anAttrName, const char *aValue, Uint32 len)
int equal (const char *anAttrName, const char *aValue)
int equal (const char *anAttrName, Int32 aValue)
int equal (const char *anAttrName, Uint32 aValue)
int equal (const char *anAttrName, Int64 aValue)
int equal (const char *anAttrName, Uint64 aValue)
int equal (Uint32 anAttrId, const char *aValue, Uint32 len)
int equal (Uint32 anAttrId, const char *aValue)
int equal (Uint32 anAttrId, Int32 aValue)
int equal (Uint32 anAttrId, Uint32 aValue)
int equal (Uint32 anAttrId, Int64 aValue)
int equal (Uint32 anAttrId, Uint64 aValue)
Specify Attribute Actions for Operations
NdbRecAttrgetValue (const char *anAttrName, char *aValue=0)
NdbRecAttrgetValue (Uint32 anAttrId, char *aValue=0)
NdbRecAttrgetValue (const NdbDictionary::Column *, char *val=0)
int setValue (const char *anAttrName, const char *aValue, Uint32 len)
int setValue (const char *anAttrName, const char *aValue)
int setValue (const char *anAttrName, Int32 aValue)
int setValue (const char *anAttrName, Uint32 aValue)
int setValue (const char *anAttrName, Int64 aValue)
int setValue (const char *anAttrName, Uint64 aValue)
int setValue (const char *anAttrName, float aValue)
int setValue (const char *anAttrName, double aValue)
int setAnyValue (Uint32 aValue)
int setOptimize (Uint32 options)
int setValue (Uint32 anAttrId, const char *aValue, Uint32 len)
int setValue (Uint32 anAttrId, const char *aValue)
int setValue (Uint32 anAttrId, Int32 aValue)
int setValue (Uint32 anAttrId, Uint32 aValue)
int setValue (Uint32 anAttrId, Int64 aValue)
int setValue (Uint32 anAttrId, Uint64 aValue)
int setValue (Uint32 anAttrId, float aValue)
int setValue (Uint32 anAttrId, double aValue)
virtual NdbBlobgetBlobHandle (const char *anAttrName)
virtual NdbBlobgetBlobHandle (Uint32 anAttrId)
virtual NdbBlobgetBlobHandle (const char *anAttrName) const
virtual NdbBlobgetBlobHandle (Uint32 anAttrId) const
Specify Interpreted Program Instructions
int incValue (const char *anAttrName, Uint32 aValue)
int incValue (const char *anAttrName, Uint64 aValue)
int incValue (Uint32 anAttrId, Uint32 aValue)
int incValue (Uint32 anAttrId, Uint64 aValue)
int subValue (const char *anAttrName, Uint32 aValue)
int subValue (const char *anAttrName, Uint64 aValue)
int subValue (Uint32 anAttrId, Uint32 aValue)
int subValue (Uint32 anAttrId, Uint64 aValue)
int def_label (int labelNumber)
int add_reg (Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest)
int sub_reg (Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest)
int load_const_u32 (Uint32 RegDest, Uint32 Constant)
int load_const_u64 (Uint32 RegDest, Uint64 Constant)
int load_const_null (Uint32 RegDest)
int read_attr (const char *anAttrName, Uint32 RegDest)
int write_attr (const char *anAttrName, Uint32 RegSource)
int read_attr (Uint32 anAttrId, Uint32 RegDest)
int write_attr (Uint32 anAttrId, Uint32 RegSource)
int branch_ge (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label)
int branch_gt (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label)
int branch_le (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label)
int branch_lt (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label)
int branch_eq (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label)
int branch_ne (Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label)
int branch_ne_null (Uint32 RegLvalue, Uint32 Label)
int branch_eq_null (Uint32 RegLvalue, Uint32 Label)
int branch_label (Uint32 Label)
int branch_col_eq_null (Uint32 ColId, Uint32 Label)
int branch_col_ne_null (Uint32 ColId, Uint32 Label)
int branch_col_eq (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label)
int branch_col_ne (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label)
int branch_col_lt (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label)
int branch_col_le (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label)
int branch_col_gt (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label)
int branch_col_ge (Uint32 ColId, const void *val, Uint32 len, bool nopad, Uint32 Label)
int branch_col_like (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label)
int branch_col_notlike (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label)
int branch_col_and_mask_eq_mask (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label)
int branch_col_and_mask_ne_mask (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label)
int branch_col_and_mask_eq_zero (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label)
int branch_col_and_mask_ne_zero (Uint32 ColId, const void *, Uint32 len, bool nopad, Uint32 Label)
int interpret_exit_ok ()
int interpret_exit_nok (Uint32 ErrorCode)
int interpret_exit_nok ()
int interpret_exit_last_row ()
int def_subroutine (int SubroutineNumber)
int call_sub (Uint32 Subroutine)
int ret_sub ()
Error Handling
const NdbErrorgetNdbError () const
int getNdbErrorLine ()
int getNdbErrorLine () const
const char * getTableName () const
const NdbDictionary::TablegetTable () const
Type getType () const

Protected Types

enum  OperationStatus {
  Init, OperationDefined, TupleKeyDefined, GetValue,
  SetValue, ExecInterpretedValue, SetValueInterpreted, FinalGetValue,
  SubroutineExec, SubroutineEnd, WaitResponse, Finished,
  UseNdbRecord
}
enum  OP_FLAGS { OF_NO_DISK = 0x1, OF_USE_ANY_VALUE = 0x2, OF_QUEUEABLE = 0x4, OF_DEFERRED_CONSTRAINTS = 0x8 }

Protected Member Functions

bool needReply ()
int init (const class NdbTableImpl *, NdbTransaction *aCon, bool useRec)
void initInterpreter ()
 NdbOperation (Ndb *aNdb, Type aType=PrimaryKeyAccess)
void next (NdbOperation *)
NdbOperationnext ()
OperationStatus Status ()
void Status (OperationStatus)
void NdbCon (NdbTransaction *)
virtual void release ()
void postExecuteRelease ()
void setStartIndicator ()
int doSendKeyReq (int processorId, GenericSectionPtr *secs, Uint32 numSecs)
int doSend (int ProcessorId, Uint32 lastFlag)
virtual int prepareSend (Uint32 TC_ConnectPtr, Uint64 TransactionId, AbortOption)
virtual void setLastFlag (NdbApiSignal *signal, Uint32 lastFlag)
int prepareSendInterpreted ()
int initInterpretedInfo (const NdbInterpretedCode *code, Uint32 *&interpretedInfo, Uint32 *stackSpace, Uint32 stackSpaceEntries, Uint32 *&dynamicSpace)
void freeInterpretedInfo (Uint32 *&dynamicSpace)
int buildInterpretedProgramSignals (Uint32 aTC_ConnectPtr, Uint64 aTransId, Uint32 **attrInfoPtr, Uint32 *remain, const NdbInterpretedCode *code, Uint32 *interpretedWorkspace, bool mainProgram, Uint32 &wordsWritten)
int buildSignalsNdbRecord (Uint32 aTC_ConnectPtr, Uint64 aTransId, const Uint32 *read_mask)
int prepareSendNdbRecord (AbortOption ao)
Uint32 fillTcKeyReqHdr (TcKeyReq *tcKeyReq, Uint32 connectPtr, Uint64 transId)
int allocKeyInfo ()
int allocAttrInfo ()
int insertKEYINFO_NdbRecord (const char *value, Uint32 byteSize)
int insertATTRINFOHdr_NdbRecord (Uint32 attrId, Uint32 attrLen)
int insertATTRINFOData_NdbRecord (const char *value, Uint32 size)
int receiveTCKEYREF (const NdbApiSignal *)
int checkMagicNumber (bool b=true)
int checkState_TransId (const NdbApiSignal *aSignal)
virtual int equal_impl (const NdbColumnImpl *, const char *aValue)
virtual NdbRecAttrgetValue_impl (const NdbColumnImpl *, char *aValue=0)
NdbRecAttrgetValue_NdbRecord (const NdbColumnImpl *tAttrInfo, char *aValue)
int setValue (const NdbColumnImpl *anAttrObject, const char *aValue)
NdbBlobgetBlobHandle (NdbTransaction *aCon, const NdbColumnImpl *anAttrObject)
NdbBlobgetBlobHandle (NdbTransaction *aCon, const NdbColumnImpl *anAttrObject) const
int incValue (const NdbColumnImpl *anAttrObject, Uint32 aValue)
int incValue (const NdbColumnImpl *anAttrObject, Uint64 aValue)
int subValue (const NdbColumnImpl *anAttrObject, Uint32 aValue)
int subValue (const NdbColumnImpl *anAttrObject, Uint64 aValue)
int read_attr (const NdbColumnImpl *anAttrObject, Uint32 RegDest)
int write_attr (const NdbColumnImpl *anAttrObject, Uint32 RegSource)
int branch_reg_reg (Uint32 type, Uint32, Uint32, Uint32)
int branch_col (Uint32 type, Uint32, const void *, Uint32, Uint32 Label)
int branch_col_null (Uint32 type, Uint32 col, Uint32 Label)
NdbBloblinkInBlobHandle (NdbTransaction *aCon, const NdbColumnImpl *column, NdbBlob *&lastPtr)
int getBlobHandlesNdbRecord (NdbTransaction *aCon, const Uint32 *mask)
int getBlobHandlesNdbRecordDelete (NdbTransaction *aCon, bool checkReadSet, const Uint32 *mask)
int insertATTRINFO (Uint32 aData)
int insertATTRINFOloop (const Uint32 *aDataPtr, Uint32 aLength)
int insertKEYINFO (const char *aValue, Uint32 aStartPosition, Uint32 aKeyLenInByte)
void reorderKEYINFO ()
virtual void setErrorCode (int aErrorCode) const
virtual void setErrorCodeAbort (int aErrorCode) const
bool isNdbRecordOperation ()
int incCheck (const NdbColumnImpl *anAttrObject)
int initial_interpreterCheck ()
int intermediate_interpreterCheck ()
int read_attrCheck (const NdbColumnImpl *anAttrObject)
int write_attrCheck (const NdbColumnImpl *anAttrObject)
int labelCheck ()
int insertCall (Uint32 aCall)
int insertBranch (Uint32 aBranch)
Uint32 ptr2int ()
Uint32 ptr2int () const
int getKeyFromTCREQ (Uint32 *data, Uint32 &size)
int getLockHandleImpl ()
int prepareGetLockHandle ()
int prepareGetLockHandleNdbRecord ()
virtual void setReadLockMode (LockMode lockMode)
NdbRecAttrgetVarValue (const NdbColumnImpl *, char *aBareValue, Uint16 *aLenLoc)
int setVarValue (const NdbColumnImpl *, const char *aBareValue, const Uint16 &aLen)
Uint32 repack_read (Uint32 len)

Static Protected Member Functions

static int handleOperationOptions (const OperationType type, const OperationOptions *opts, const Uint32 sizeOfOptions, NdbOperation *op)

Protected Attributes

void * m_customData
Type m_type
NdbReceiver theReceiver
NdbError theError
int theErrorLine
NdbtheNdb
NdbTransactiontheNdbCon
NdbOperationtheNext
union {
   NdbApiSignal *   theTCREQ
   NdbApiSignal *   theSCAN_TABREQ
   NdbApiSignal *   theRequest
}; 
NdbApiSignaltheFirstATTRINFO
NdbApiSignaltheCurrentATTRINFO
Uint32 theTotalCurrAI_Len
Uint32 theAI_LenInCurrAI
NdbApiSignaltheLastKEYINFO
class NdbLabeltheFirstLabel
class NdbLabeltheLastLabel
class NdbBranchtheFirstBranch
class NdbBranchtheLastBranch
class NdbCalltheFirstCall
class NdbCalltheLastCall
class NdbSubroutinetheFirstSubroutine
class NdbSubroutinetheLastSubroutine
Uint32 theNoOfLabels
Uint32 theNoOfSubroutines
Uint32 * theKEYINFOptr
Uint32 keyInfoRemain
Uint32 * theATTRINFOptr
Uint32 attrInfoRemain
class NdbTableImplm_currentTable
class NdbTableImplm_accessTable
Uint32 theTupleKeyDefined [NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY][3]
Uint32 theTotalNrOfKeyWordInSignal
Uint32 theTupKeyLen
Uint8 theNoOfTupKeyLeft
OperationType theOperationType
LockMode theLockMode
OperationStatus theStatus
Uint32 theMagicNumber
Uint32 theScanInfo
Uint32 theDistributionKey
Uint32 theSubroutineSize
Uint32 theInitialReadSize
Uint32 theInterpretedSize
Uint32 theFinalUpdateSize
Uint32 theFinalReadSize
Uint8 theStartIndicator
Uint8 theCommitIndicator
Uint8 theSimpleIndicator
Uint8 theDirtyIndicator
Uint8 theInterpretIndicator
Int8 theDistrKeyIndicator_
Uint8 m_flags
Uint8 _unused1
Uint16 m_tcReqGSN
Uint16 m_keyInfoGSN
Uint16 m_attrInfoGSN
const NdbRecordm_key_record
const char * m_key_row
Uint32 m_keyinfo_length
const NdbRecordm_attribute_record
const char * m_attribute_row
Uint32 m_unused_read_mask [(128+31)>>5]
const NdbInterpretedCodem_interpreted_code
const SetValueSpecm_extraSetValues
Uint32 m_numExtraSetValues
Uint32 m_any_value
NdbBlobtheBlobList
Int8 m_abortOption
Int8 m_noErrorPropagation
NdbLockHandletheLockHandle
bool m_blob_lock_upgraded

Friends

class Ndb
class NdbTransaction
class NdbScanOperation
class NdbScanReceiver
class NdbScanFilter
class NdbScanFilterImpl
class NdbReceiver
class NdbBlob
struct Ndb_free_list_t< NdbOperation >

Define Standard Operation Type

enum  Type { PrimaryKeyAccess = 0, UniqueIndexAccess = 1, TableScan = 2, OrderedIndexScan = 3 }
enum  LockMode {
  LM_Read = 0, LM_Exclusive = 1, LM_CommittedRead = 2, LM_Dirty = 2,
  LM_SimpleRead = 3
}
enum  AbortOption { DefaultAbortOption = -1, AbortOnError = 0, AO_IgnoreError = 2 }
virtual int insertTuple ()
virtual int updateTuple ()
virtual int writeTuple ()
virtual int deleteTuple ()
virtual int readTuple (LockMode)
virtual int readTuple ()
virtual int readTupleExclusive ()
virtual int simpleRead ()
virtual int dirtyRead ()
virtual int committedRead ()
virtual int dirtyUpdate ()
virtual int dirtyWrite ()

Detailed Description

Class of operations for use in transactions.

Definition at line 45 of file NdbOperation.hpp.

Member Enumeration Documentation

How should transaction be handled if operation fails.

If AO_IgnoreError, a failure in one operation will not abort the transaction, and NdbTransaction::execute() will return 0 (success). Use NdbOperation::getNdbError() to check for errors from individual operations.

If AbortOnError, a failure in one operation will abort the transaction and cause NdbTransaction::execute() to return -1.

Abort option can be set on execute(), or in the individual operation. Setting AO_IgnoreError or AbortOnError in execute() overrides the settings on individual operations. Setting DefaultAbortOption in execute() (the default) causes individual operation settings to be used.

For READ, default is AO_IgnoreError DML, default is AbortOnError CommittedRead does only support AO_IgnoreError

Enumerator:
DefaultAbortOption 

Use default as specified by op-type.

AbortOnError 

Abort transaction on failed operation.

AO_IgnoreError 

Transaction continues on failed operation.

Definition at line 128 of file NdbOperation.hpp.

Lock when performing read

Enumerator:
LM_Read 

Read with shared lock.

LM_Exclusive 

Read with exclusive lock.

LM_CommittedRead 

Ignore locks, read last committed value.

LM_SimpleRead 

Read with shared lock, but release lock directly.

Definition at line 91 of file NdbOperation.hpp.

Type of operation

Enumerator:
ReadRequest 

Read operation.

UpdateRequest 

Update Operation.

InsertRequest 

Insert Operation.

DeleteRequest 

Delete Operation.

WriteRequest 

Write Operation.

ReadExclusive 

Read exclusive.

UnlockRequest 

Unlock operation.

OpenScanRequest 

Scan Operation.

OpenRangeScanRequest 

Range scan operation.

NotDefined2 

Internal for debugging.

NotDefined 

Internal for debugging.

Definition at line 910 of file NdbOperation.hpp.

Different access types (supported by sub-classes of NdbOperation)

Enumerator:
PrimaryKeyAccess 

Read, insert, update, or delete using pk.

UniqueIndexAccess 

Read, update, or delete using unique index.

TableScan 

Full table scan.

OrderedIndexScan 

Ordered index scan.

Definition at line 68 of file NdbOperation.hpp.

Member Function Documentation

int NdbOperation::add_reg ( Uint32  RegSource1,
Uint32  RegSource2,
Uint32  RegDest 
)

Interpreted program instruction: Add two registers into a third.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
RegSource1First register.
RegSource2Second register.
RegDestDestination register where the result will be stored.
Returns
-1 if unsuccessful.

Definition at line 636 of file NdbOperationInt.cpp.

int NdbOperation::branch_col_and_mask_eq_mask ( Uint32  ColId,
const void *  mask,
Uint32  len,
bool  nopad,
Uint32  Label 
)

Bitwise logical comparisons

These comparison types are only supported for the Bitfield type They can be used to test for bit patterns in bitfield columns The value passed is a bitmask which is bitwise-ANDed with the column data. Bitfields are passed in/out of NdbApi as 32-bit words with bits set from lsb to msb. The platform's endianness controls which byte contains the ls bits. x86= first(0th) byte. Sparc/PPC= last (3rd byte)

To set bit n of a bitmask to 1 from a Uint32* mask : mask[n >> 5] |= (1 << (n & 31))

The branch can be taken in 4 cases :

  • Column data AND Mask == Mask (all masked bits are set in data)
  • Column data AND Mask != Mask (not all masked bits are set in data)
  • Column data AND Mask == 0 (No masked bits are set in data)
  • Column data AND Mask != 0 (Some masked bits are set in data)

Definition at line 1229 of file NdbOperationInt.cpp.

int NdbOperation::branch_col_eq ( Uint32  ColId,
const void *  val,
Uint32  len,
bool  nopad,
Uint32  Label 
)

Interpreted program instruction: branch after memcmp

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
ColIdcolumn to check
valsearch value
lenlength of search value
nopadforce non-padded comparison for a Char column
Labellabel to jump to
Returns
-1 if unsuccessful

Definition at line 1168 of file NdbOperationInt.cpp.

int NdbOperation::branch_col_eq_null ( Uint32  ColId,
Uint32  Label 
)

Interpreted program instruction: branch after memcmp

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
ColIdColumn to check
LabelLabel to jump to
Returns
-1 if unsuccessful

Definition at line 1283 of file NdbOperationInt.cpp.

int NdbOperation::branch_col_like ( Uint32  ColId,
const void *  val,
Uint32  len,
bool  nopad,
Uint32  Label 
)

LIKE/NOTLIKE wildcard comparisons These instructions support SQL-style % and _ wildcards for (VAR)CHAR/BINARY columns only

The argument is always plain char format, even if the field is varchar (changed in 5.0.22).

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.

Definition at line 1213 of file NdbOperationInt.cpp.

int NdbOperation::branch_eq_null ( Uint32  RegLvalue,
Uint32  Label 
)

Interpreted program instruction: Jump to Label if RegLvalue is equal to NULL.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
RegLvalueValue to check.
LabelLabel to jump to.
Returns
-1 if unsuccessful.

Definition at line 892 of file NdbOperationInt.cpp.

int NdbOperation::branch_ge ( Uint32  RegLvalue,
Uint32  RegRvalue,
Uint32  Label 
)

Interpreted program instruction: Define a search condition. Last two letters in the function name describes the search condition. The condition compares RegR with RegL and therefore appears to be reversed.

  • ge RegR >= RegL
  • gt RegR > RegL
  • le RegR <= RegL
  • lt RegR < RegL
  • eq RegR = RegL
  • ne RegR <> RegL
Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
RegLvalueleft value.
RegRvalueright value.
Labelthe label to jump to.
Returns
-1 if unsuccessful.

Definition at line 830 of file NdbOperationInt.cpp.

int NdbOperation::branch_label ( Uint32  Label)

Interpreted program instruction: Jump to Label.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
LabelLabel to jump to.
Returns
-1 if unsuccessful.

Definition at line 906 of file NdbOperationInt.cpp.

int NdbOperation::branch_ne_null ( Uint32  RegLvalue,
Uint32  Label 
)

Interpreted program instruction: Jump to Label if RegLvalue is not NULL.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
RegLvaluethe value to check.
Labelthe label to jump to.
Returns
-1 if unsuccessful.

Definition at line 878 of file NdbOperationInt.cpp.

int NdbOperation::call_sub ( Uint32  Subroutine)

Interpreted program instruction: Call a subroutine.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
Subroutinethe subroutine to call.
Returns
-1 if unsuccessful.

Definition at line 978 of file NdbOperationInt.cpp.

int NdbOperation::committedRead ( )
virtual

Define the NdbOperation to be a standard operation of type committedRead. When calling NdbTransaction::execute, this operation read latest committed value of the record.

This means that if another transaction is updating the record, then the current transaction will not wait. It will instead use the latest committed value of the record.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 215 of file NdbOperationDefine.cpp.

Here is the caller graph for this function:

int NdbOperation::def_label ( int  labelNumber)

Interpreted program instruction: Define a jump label in an interpreted operation.

Note
The labels are automatically numbered starting with 0. The parameter used by NdbOperation::def_label should match the automatic numbering to make it easier to debug the interpreted program.
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
labelNumberLabel number.
Returns
Label number, -1 if unsuccessful.

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.

Definition at line 496 of file NdbOperationInt.cpp.

int NdbOperation::def_subroutine ( int  SubroutineNumber)

Interpreted program instruction: Define a subroutine in an interpreted operation.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
SubroutineNumberthe subroutine number.
Returns
-1 if unsuccessful.

Definition at line 556 of file NdbOperationInt.cpp.

int NdbOperation::deleteTuple ( )
virtual

Define the NdbOperation to be a standard operation of type deleteTuple. When calling NdbTransaction::execute, this operation delete a tuple.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 94 of file NdbOperationDefine.cpp.

int NdbOperation::dirtyRead ( )
virtual

Define the NdbOperation to be a standard operation of type committedRead. When calling NdbTransaction::execute, this operation read latest committed value of the record.

This means that if another transaction is updating the record, then the current transaction will not wait. It will instead use the latest committed value of the record. dirtyRead is a deprecated name for committedRead

Returns
0 if successful otherwise -1.
Deprecated:

Reimplemented in NdbIndexOperation.

Definition at line 206 of file NdbOperationDefine.cpp.

Here is the call graph for this function:

int NdbOperation::dirtyUpdate ( )
virtual

Define the NdbOperation to be a standard operation of type dirtyUpdate. When calling NdbTransaction::execute, this operation updates without two-phase commit.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 237 of file NdbOperationDefine.cpp.

int NdbOperation::dirtyWrite ( )
virtual

Define the NdbOperation to be a standard operation of type dirtyWrite. When calling NdbTransaction::execute, this operation writes without two-phase commit.

Returns
0 if successful otherwise -1.

Definition at line 261 of file NdbOperationDefine.cpp.

int NdbOperation::equal ( const char *  anAttrName,
const char *  aValue,
Uint32  len 
)
inline

Define a search condition with equality. The condition is true if the attribute has the given value. To set search conditions on multiple attributes, use several equals (then all of them must be satisfied for the tuple to be selected).

Note
For insertTuple() it is also allowed to define the search key by using setValue().
There are 10 versions of equal() with slightly different parameters.
If attribute has fixed size, value must include all bytes. In particular a Char must be native-blank padded. If attribute has variable size, value must start with 1 or 2 little-endian length bytes (2 if Long*).
Parameters
anAttrNameAttribute name
aValueAttribute value.
Returns
-1 if unsuccessful.

Definition at line 1674 of file NdbOperation.hpp.

Here is the caller graph for this function:

NdbOperation::AbortOption NdbOperation::getAbortOption ( ) const

Get/set abort option

Definition at line 1049 of file NdbOperationDefine.cpp.

NdbBlob * NdbOperation::getBlobHandle ( const char *  anAttrName)
virtual

This method replaces getValue/setValue for blobs. It creates a blob handle NdbBlob. A second call with same argument returns the previously created handle. The handle is linked to the operation and is maintained automatically.

See NdbBlob for details.

For NdbRecord operation, this method can be used to fetch the blob handle for an NdbRecord operation that references the blob, but extra blob columns can not be added with this call (it will return 0).

For reading with NdbRecord, the NdbRecord entry for each blob must reserve space in the row for sizeof(NdbBlob *). The blob handle will be stored there, providing an alternative way of obtaining the blob handle.

Reimplemented in NdbScanOperation.

Definition at line 395 of file NdbOperation.cpp.

LockMode NdbOperation::getLockMode ( ) const
inline

Return lock mode for operation

Definition at line 929 of file NdbOperation.hpp.

const NdbError & NdbOperation::getNdbError ( ) const

Get the latest error code.

Returns
error code.

Definition at line 59 of file Ndberr.cpp.

Here is the caller graph for this function:

int NdbOperation::getNdbErrorLine ( )
inline

Get the method number where the error occured.

Returns
method number where the error occured.

Definition at line 1564 of file NdbOperation.hpp.

NdbTransaction * NdbOperation::getNdbTransaction ( ) const
virtual

Get NdbTransaction object pointer for this operation

Reimplemented in NdbScanOperation.

Definition at line 546 of file NdbOperation.cpp.

const NdbDictionary::Table * NdbOperation::getTable ( ) const

Get table object for this operation Not supported for NdbRecord operation.

Definition at line 540 of file NdbOperation.cpp.

Here is the caller graph for this function:

const char * NdbOperation::getTableName ( ) const

Get table name of this operation. Not supported for NdbRecord operation.

Definition at line 534 of file NdbOperation.cpp.

Here is the call graph for this function:

NdbOperation::Type NdbOperation::getType ( ) const
inline

Get the type of access for this operation

Definition at line 1626 of file NdbOperation.hpp.

Here is the caller graph for this function:

NdbRecAttr * NdbOperation::getValue ( const char *  anAttrName,
char *  aValue = 0 
)

Defines a retrieval operation of an attribute value. The NDB API allocate memory for the NdbRecAttr object that will hold the returned attribute value.

Note
Note that it is the applications responsibility to allocate enough memory for aValue (if non-NULL). The buffer aValue supplied by the application must be aligned appropriately. The buffer is used directly (avoiding a copy penalty) only if it is aligned on a 4-byte boundary and the attribute size in bytes (i.e. NdbRecAttr::attrSize times NdbRecAttr::arraySize is a multiple of 4).
There are two versions of NdbOperation::getValue with slightly different parameters.
This method does not fetch the attribute value from the database! The NdbRecAttr object returned by this method is not readable/printable before the transaction has been executed with NdbTransaction::execute.
Parameters
anAttrNameAttribute name
aValueIf this is non-NULL, then the attribute value will be returned in this parameter.
If NULL, then the attribute value will only be stored in the returned NdbRecAttr object.
Returns
An NdbRecAttr object to hold the value of the attribute, or a NULL pointer (indicating error).

Definition at line 311 of file NdbOperation.cpp.

Here is the caller graph for this function:

int NdbOperation::incValue ( const char *  anAttrName,
Uint32  aValue 
)

Interpreted program instruction: Add a value to an attribute.

Note
Destroys the contents of registers 6 and 7. (The instruction uses these registers for its operation.)
There are four versions of NdbOperation::incValue with slightly different parameters.
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
anAttrNameAttribute name.
aValueValue to add.
Returns
-1 if unsuccessful.

Definition at line 462 of file NdbOperation.cpp.

int NdbOperation::insertTuple ( )
virtual

Define the NdbOperation to be a standard operation of type insertTuple. When calling NdbTransaction::execute, this operation adds a new tuple to the table.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 31 of file NdbOperationDefine.cpp.

int NdbOperation::interpret_exit_last_row ( )

Interpreted program instruction:

abort the whole transaction.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Returns
-1 if unsuccessful.

Definition at line 936 of file NdbOperationInt.cpp.

int NdbOperation::interpret_exit_nok ( Uint32  ErrorCode)

Interpreted program instruction: Exit with Not Ok

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
A method also exists without the error parameter.
Parameters
ErrorCodeAn error code given by the application programmer.
Returns
-1 if unsuccessful.

Definition at line 952 of file NdbOperationInt.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int NdbOperation::interpret_exit_ok ( )

Interpreted program instruction: Exit with Ok

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Returns
-1 if unsuccessful.

Definition at line 924 of file NdbOperationInt.cpp.

int NdbOperation::interpretedDeleteTuple ( )
virtual

Delete a tuple using an interpreted program.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 309 of file NdbOperationDefine.cpp.

int NdbOperation::interpretedUpdateTuple ( )
virtual

Update a tuple using an interpreted program.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 285 of file NdbOperationDefine.cpp.

int NdbOperation::load_const_null ( Uint32  RegDest)

Interpreted program instruction: Load NULL value into a register.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
RegDestDestination register.
Returns
-1 if unsuccessful.

Definition at line 752 of file NdbOperationInt.cpp.

int NdbOperation::load_const_u32 ( Uint32  RegDest,
Uint32  Constant 
)

Interpreted program instruction: Load a constant into a register.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
RegDestDestination register.
ConstantValue to load.
Returns
-1 if unsuccessful.

Definition at line 700 of file NdbOperationInt.cpp.

int NdbOperation::prepareSend ( Uint32  TC_ConnectPtr,
Uint64  TransactionId,
AbortOption  ao 
)
protectedvirtual

A dirty read, can not abort the transaction

Set correct length on last KeyInfo signal

Definition at line 386 of file NdbOperationExec.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int NdbOperation::read_attr ( const char *  anAttrName,
Uint32  RegDest 
)

Interpreted program instruction: Read an attribute into a register.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
anAttrNameAttribute name.
RegDestDestination register.
Returns
-1 if unsuccessful.

Definition at line 510 of file NdbOperation.cpp.

Here is the caller graph for this function:

int NdbOperation::read_attr ( Uint32  anAttrId,
Uint32  RegDest 
)

Interpreted program instruction: Read an attribute into a register.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
anAttrIdthe attribute id.
RegDestthe destination register.
Returns
-1 if unsuccessful.

Definition at line 516 of file NdbOperation.cpp.

Here is the call graph for this function:

int NdbOperation::readTuple ( NdbOperation::LockMode  lm)
virtual

Define the NdbOperation to be a standard operation of type readTuple. When calling NdbTransaction::execute, this operation reads a tuple.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 116 of file NdbOperationDefine.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int NdbOperation::readTuple ( )
virtual

Define the NdbOperation to be a standard operation of type readTuple. When calling NdbTransaction::execute, this operation reads a tuple.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 138 of file NdbOperationDefine.cpp.

Here is the caller graph for this function:

int NdbOperation::readTupleExclusive ( )
virtual

Define the NdbOperation to be a standard operation of type readTupleExclusive. When calling NdbTransaction::execute, this operation read a tuple using an exclusive lock.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 160 of file NdbOperationDefine.cpp.

Here is the caller graph for this function:

int NdbOperation::receiveTCKEYREF ( const NdbApiSignal aSignal)
protected

If TCKEYCONF has arrived op has completed (maybe trans has completed)

Definition at line 1737 of file NdbOperationExec.cpp.

int NdbOperation::ret_sub ( )

Interpreted program instruction: End a subroutine.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Returns
-1 if unsuccessful.

Definition at line 992 of file NdbOperationInt.cpp.

void NdbOperation::setPartitionId ( Uint32  id)

Set/get partition key

Definition at line 524 of file NdbOperationSearch.cpp.

Here is the call graph for this function:

int NdbOperation::setValue ( const char *  anAttrName,
const char *  aValue,
Uint32  len 
)
inline

Define an attribute to set or update in query.

To set a NULL value, use the following construct:

setValue("ATTR_NAME", (char*)NULL);

There are a number of NdbOperation::setValue methods that take a certain type as input (pass by value rather than passing a pointer). As the interface is currently implemented it is the responsibility of the application programmer to use the correct types.

The NDB API will however check that the application sends a correct length to the interface as given in the length parameter. The passing of char* as the value can contain any type or any type of array. If length is not provided or set to zero, then the API will assume that the pointer is correct and not bother with checking it.

Note
For insertTuple() the NDB API will automatically detect that it is supposed to use equal() instead.
For insertTuple() it is not necessary to use setValue() on key attributes before other attributes.
There are 14 versions of NdbOperation::setValue with slightly different parameters.
See note under equal() about value format and length.
Parameters
anAttrNameName (or Id) of attribute.
aValueAttribute value to set.
Returns
-1 if unsuccessful.

Definition at line 1748 of file NdbOperation.hpp.

Here is the caller graph for this function:

int NdbOperation::simpleRead ( )
virtual

Define the NdbOperation to be a standard operation of type simpleRead. When calling NdbTransaction::execute, this operation reads an existing tuple (using shared read lock), but releases lock immediately after read.

Note
Using this operation twice in the same transaction may produce different results (e.g. if there is another transaction which updates the value between the simple reads).

Note that simpleRead can read the value from any database node while standard read always read the value on the database node which is primary for the record.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 182 of file NdbOperationDefine.cpp.

Here is the caller graph for this function:

int NdbOperation::sub_reg ( Uint32  RegSource1,
Uint32  RegSource2,
Uint32  RegDest 
)

Interpreted program instruction: Substract RegSource2 from RegSource1 and put the result in RegDest.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
RegSource1First register.
RegSource2Second register.
RegDestDestination register where the result will be stored.
Returns
-1 if unsuccessful.

Definition at line 668 of file NdbOperationInt.cpp.

int NdbOperation::subValue ( const char *  anAttrName,
Uint32  aValue 
)

Interpreted program instruction: Subtract a value from an attribute in an interpreted operation.

Note
Destroys the contents of registers 6 and 7. (The instruction uses these registers for its operation.)
There are four versions of NdbOperation::subValue with slightly different parameters.
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
anAttrNameAttribute name.
aValueValue to subtract.
Returns
-1 if unsuccessful.

Definition at line 486 of file NdbOperation.cpp.

int NdbOperation::updateTuple ( )
virtual

Define the NdbOperation to be a standard operation of type updateTuple. When calling NdbTransaction::execute, this operation updates a tuple in the table.

Returns
0 if successful otherwise -1.

Reimplemented in NdbIndexOperation.

Definition at line 52 of file NdbOperationDefine.cpp.

int NdbOperation::write_attr ( const char *  anAttrName,
Uint32  RegSource 
)

Interpreted program instruction: Write an attribute from a register.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
anAttrNameAttribute name.
RegSourceSource register.
Returns
-1 if unsuccessful.

Definition at line 522 of file NdbOperation.cpp.

Here is the caller graph for this function:

int NdbOperation::write_attr ( Uint32  anAttrId,
Uint32  RegSource 
)

Interpreted program instruction: Write an attribute from a register.

Note
For Scans and NdbRecord operations, use the NdbInterpretedCode interface.
Parameters
anAttrIdthe attribute id.
RegSourcethe source register.
Returns
-1 if unsuccessful.

Definition at line 528 of file NdbOperation.cpp.

Here is the call graph for this function:

int NdbOperation::writeTuple ( )
virtual

Define the NdbOperation to be a standard operation of type writeTuple. When calling NdbTransaction::execute, this operation writes a tuple to the table. If the tuple exists, it updates it, otherwise an insert takes place.

Returns
0 if successful otherwise -1.

Definition at line 73 of file NdbOperationDefine.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class Ndb
friend

Reciver(s)

Definition at line 48 of file NdbOperation.hpp.


The documentation for this class was generated from the following files: