2.3.23.2 NdbInterpretedCode Methods

2.3.23.2.1 NdbInterpretedCode Constructor
2.3.23.2.2 NdbInterpretedCode::add_reg()
2.3.23.2.3 NdbInterpretedCode::add_val()
2.3.23.2.4 NdbInterpretedCode::branch_col_and_mask_eq_mask()
2.3.23.2.5 NdbInterpretedCode::branch_col_and_mask_eq_zero()
2.3.23.2.6 NdbInterpretedCode::branch_col_and_mask_ne_mask()
2.3.23.2.7 NdbInterpretedCode::branch_col_and_mask_ne_zero()
2.3.23.2.8 NdbInterpretedCode::branch_col_eq()
2.3.23.2.9 NdbInterpretedCode::branch_col_eq_null()
2.3.23.2.10 NdbInterpretedCode::branch_col_ge()
2.3.23.2.11 NdbInterpretedCode::branch_col_gt()
2.3.23.2.12 NdbInterpretedCode::branch_col_le()
2.3.23.2.13 NdbInterpretedCode::branch_col_like()
2.3.23.2.14 NdbInterpretedCode::branch_col_lt()
2.3.23.2.15 NdbInterpretedCode::branch_col_ne()
2.3.23.2.16 NdbInterpretedCode::branch_col_ne_null()
2.3.23.2.17 NdbInterpretedCode::branch_col_notlike()
2.3.23.2.18 NdbInterpretedCode::branch_eq()
2.3.23.2.19 NdbInterpretedCode::branch_eq_null()
2.3.23.2.20 NdbInterpretedCode::branch_ge()
2.3.23.2.21 NdbInterpretedCode::branch_gt()
2.3.23.2.22 NdbInterpretedCode::branch_label()
2.3.23.2.23 NdbInterpretedCode::branch_le()
2.3.23.2.24 NdbInterpretedCode::branch_lt()
2.3.23.2.25 NdbInterpretedCode::branch_ne()
2.3.23.2.26 NdbInterpretedCode::branch_ne_null()
2.3.23.2.27 NdbInterpretedCode::call_sub()
2.3.23.2.28 NdbInterpretedCode::copy()
2.3.23.2.29 NdbInterpretedCode::def_label()
2.3.23.2.30 NdbInterpretedCode::def_sub()
2.3.23.2.31 NdbInterpretedCode::finalise()
2.3.23.2.32 NdbInterpretedCode::getNdbError()
2.3.23.2.33 NdbInterpretedCode::getTable()
2.3.23.2.34 NdbInterpretedCode::getWordsUsed()
2.3.23.2.35 NdbInterpretedCode::interpret_exit_last_row()
2.3.23.2.36 NdbInterpretedCode::interpret_exit_nok()
2.3.23.2.37 NdbInterpretedCode::interpret_exit_ok()
2.3.23.2.38 NdbInterpretedCode::load_const_null()
2.3.23.2.39 NdbInterpretedCode::load_const_u16()
2.3.23.2.40 NdbInterpretedCode::load_const_u32()
2.3.23.2.41 NdbInterpretedCode::load_const_u64()
2.3.23.2.42 NdbInterpretedCode::read_attr()
2.3.23.2.43 NdbInterpretedCode::ret_sub()
2.3.23.2.44 NdbInterpretedCode::sub_reg()
2.3.23.2.45 NdbInterpretedCode::sub_val()
2.3.23.2.46 NdbInterpretedCode::write_attr()

This section provides information about the public methods of the NdbInterpretedCode class, grouped together by function.

2.3.23.2.1 NdbInterpretedCode Constructor

Description.  This is the NdbInterpretedCode class constuctor.

Signature. 

NdbInterpretedCode
    (
      const NdbDictionary::Table* table = 0,
      Uint32* buffer = 0,
      Uint32 buffer_word_size = 0
    )

Parameters.  The NdbInterpretedCode constructor takes three parameters, as described here:

  • The table against which this program is to be run. This parameter must be supplied if the program is table-specific—that is, if it reads from or writes to columns in a table.

  • A pointer to a buffer of 32-bit words used to store the program.

  • buffer_word_size is the length of the buffer passed in. If the program exceeds this length then adding new instructions will fail with error 4518 Too many instructions in interpreted program.

    Alternatively, if no buffer is passed, a buffer will be dynamically allocated internally and extended to cope as instructions are added.

Return value.  An instance of NdbInterpretedCode.

2.3.23.2.2 NdbInterpretedCode::add_reg()

Description.  This method sums the values stored in any two given registers and stores the result in a third register.

Signature. 

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

Parameters.  This method takes three parameters. The first of these is the register in which the result is to be stored (RegDest). The second and third parameters (RegSource1 and RegSource2) are the registers whose values are to be summed.

Note

It is possible to re-use for storing the result one of the registers whose values are summed; that is, RegDest can be the same as RegSource1 or RegSource2.

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.3 NdbInterpretedCode::add_val()

Description.  This method adds a specified value to the value of a given table column, and places the original and modified column values in registers 6 and 7. It is equivalent to the following series of NdbInterpretedCode method calls, where attrId is the table column' attribute ID and aValue is the value to be added:

read_attr(6, attrId);
load_const_u32(7, aValue);
add_reg(7,6,7);
write_attr(attrId, 7);

aValue can be a 32-bit or 64-bit integer.

Signature.  This method can be invoked in either of two ways, depending on whether aValue is 32-bit or 64-bit.

32-bit aValue:

int add_val
    (
      Uint32 attrId,
      Uint32 aValue
    )

64-bit aValue:

int add_val
    (
      Uint32 attrId,
      Uint64 aValue
    )

Parameters.  A table column attribute ID and a 32-bit or 64-bit integer value to be added to this column value.

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.4 NdbInterpretedCode::branch_col_and_mask_eq_mask()

Description.  This method is used to compare a BIT column value with a bitmask; if the column value ANDed together with the bitmask is equal to the bitmask, then execution jumps to a specified label specified in the method call.

Signature. 

int branch_col_and_mask_eq_mask
    (
      const void* mask,
      Uint32 unused,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method can accept four parameters, of which three are actually used. These are described in the following list:

  • A pointer to a constant mask to compare the column value to

  • A Uint32 value which is currently unused.

  • The attrId of the column to be compared.

  • A program Label to jump to if the condition is true.

Return value.  This method returns 0 on success and -1 on failure.

2.3.23.2.5 NdbInterpretedCode::branch_col_and_mask_eq_zero()

Description.  This method is used to compare a BIT column value with a bitmask; if the column value ANDed together with the bitmask is equal to 0, then execution jumps to a specified label specified in the method call.

Signature. 

int branch_col_and_mask_eq_zero
    (
      const void* mask,
      Uint32 unused,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method can accept the following four parameters, of which three are actually used:

  • A pointer to a constant mask to compare the column value to.

  • A Uint32 value which is currently unused.

  • The attrId of the column to be compared.

  • A program Label to jump to if the condition is true.

Return value.  This method returns 0 on success and -1 on failure.

2.3.23.2.6 NdbInterpretedCode::branch_col_and_mask_ne_mask()

Description.  This method is used to compare a BIT column value with a bitmask; if the column value ANDed together with the bitmask is not equal to the bitmask, then execution jumps to a specified label specified in the method call.

Signature. 

int branch_col_and_mask_ne_mask
    (
      const void* mask,
      Uint32 unused,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method accepts four parameters, of which three are actually used. These described in the following list:

  • A pointer to a constant mask to compare the column value to.

  • A Uint32 value which is currently unused.

  • The attrId of the column to be compared.

  • A program Label to jump to if the condition is true.

Return value.  This method returns 0 on success and -1 on failure.

2.3.23.2.7 NdbInterpretedCode::branch_col_and_mask_ne_zero()

Description.  This method is used to compare a BIT column value with a bitmask; if the column value ANDed together with the bitmask is not equal to 0, then execution jumps to a specified label specified in the method call.

Signature. 

int branch_col_and_mask_ne_zero
    (
      const void* mask,
      Uint32 unused,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method accepts the following four parameters, of which three are actually used:

  • A pointer to a constant mask to compare the column value to.

  • A Uint32 value which is currently unused.

  • The attrId of the column to be compared.

  • A program Label to jump to if the condition is true.

Return value.  This method returns 0 on success and -1 on failure.

2.3.23.2.8 NdbInterpretedCode::branch_col_eq()

Description.  This method compares a table column value with an arbitrary constant and jumps to the specified program label if the values are equal.

Signature. 

int branch_col_eq
    (
      const void* val,
      Uint32 len,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method takes the following four parameters:

  • A constant value (val)

  • The length of the value (in bytes)

  • The attribute ID of the table column whose value is to be compared with val

  • A Label (previously defined using def_label()) to jump to if the compared values are equal

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.9 NdbInterpretedCode::branch_col_eq_null()

Description.  This method tests the value of a table column and jumps to the indicated program label if the column value is NULL.

Signature. 

int branch_col_eq_null
    (
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method requires the following two parameters:

  • The attribute ID of the table column

  • The program label to jump to if the column value is NULL

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.10 NdbInterpretedCode::branch_col_ge()

Description.  This method compares a table column value with an arbitrary constant and jumps to the specified program label if the constant is greater than or equal to the column value.

Signature. 

int branch_col_ge
    (
      const void* val,
      Uint32 len,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method takes the four parameters listed here:

  • A constant value (val)

  • The length of the value (in bytes)

  • The attribute ID of the table column whose value is to be compared with val

  • A Label (previously defined using def_label()) to jump to if the constant value is greater than or equal to the column value

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.11 NdbInterpretedCode::branch_col_gt()

Description.  This method compares a table column value with an arbitrary constant and jumps to the specified program label if the constant is greater than the column value.

Signature. 

int branch_col_gt
    (
      const void* val,
      Uint32 len,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method takes the following four parameters:

  • A constant value (val)

  • The length of the value (in bytes)

  • The attribute ID of the table column whose value is to be compared with val

  • A Label (previously defined using def_label()) to jump to if the constant value is greater than the column value

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.12 NdbInterpretedCode::branch_col_le()

Description.  This method compares a table column value with an arbitrary constant and jumps to the specified program label if the constant is less than or equal to the column value.

Signature. 

int branch_col_le
    (
      const void* val,
      Uint32 len,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method takes the four parameters listed here:

  • A constant value (val)

  • The length of the value (in bytes)

  • The attribute ID of the table column whose value is to be compared with val

  • A Label (previously defined using def_label()) to jump to if the constant value is less than or equal to the column value

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.13 NdbInterpretedCode::branch_col_like()

Description.  This method tests a table column value against a regular expression pattern and jumps to the indicated program label if they match.

Signature. 

int branch_col_like
    (
      const void* val,
      Uint32 len,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method takes four parameters, which are listed here:

Return value.  0 on success, -1 on failure

2.3.23.2.14 NdbInterpretedCode::branch_col_lt()

Description.  This method compares a table column value with an arbitrary constant and jumps to the specified program label if the constant is less than the column value.

Signature. 

int branch_col_lt
    (
      const void* val,
      Uint32 len,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method takes the following four parameters:

  • A constant value (val)

  • The length of the value (in bytes)

  • The attribute ID of the table column whose value is to be compared with val

  • A Label (previously defined using def_label()) to jump to if the constant value is less than the column value

Return value.  0 on success, -1 on failure.

2.3.23.2.15 NdbInterpretedCode::branch_col_ne()

Description.  This method compares a table column value with an arbitrary constant and jumps to the specified program label if the two values are not equal.

Signature. 

int branch_col_ne
    (
      const void* val,
      Uint32 len,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method takes the four parameters listed here:

  • A constant value (val)

  • The length of the value (in bytes)

  • The attribute ID of the table column whose value is to be compared with val

  • A Label (previously defined using def_label()) to jump to if the compared values are unequal

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.16 NdbInterpretedCode::branch_col_ne_null()

Description.  This method tests the value of a table column and jumps to the indicated program label if the column value is not NULL.

Signature. 

int branch_col_ne_null
    (
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method requires the following two parameters:

  • The attribute ID of the table column

  • The program label to jump to if the column value is not NULL

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.17 NdbInterpretedCode::branch_col_notlike()

Description.  This method is similar to branch_col_like() in that it tests a table column value against a regular expression pattern; however it jumps to the indicated program label only if the pattern and the column value do not match.

Signature. 

int branch_col_notlike
    (
      const void* val,
      Uint32 len,
      Uint32 attrId,
      Uint32 Label
    )

Parameters.  This method takes the following four parameters:

Return value.  Returns 0 on success, -1 on failure

2.3.23.2.18 NdbInterpretedCode::branch_eq()

Description.  This method compares two register values; if they equal, then the interpreted program jumps to the specified label.

Signature. 

int branch_eq
    (
      Uint32 RegLvalue,
      Uint32 RegRvalue,
      Uint32 Label
    )

Parameters.  This method takes three parameters, the registers whose values are to be compared—RegLvalue and RegRvalue—and the program Label to jump to if they are equal. Label must have been defined previously using def_label() (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Return value.  0 on success, -1 on failure.

2.3.23.2.19 NdbInterpretedCode::branch_eq_null()

Description.  This method compares a register value with NULL; if the register value is null, then the interpreted program jumps to the specified label.

Signature. 

int branch_eq_null
    (
      Uint32 RegLvalue,
      Uint32 Label
    )

Parameters.  This method takes two parameters, the register whose value is to be compared with NULL (RegLvalue) and the program Label to jump to if RegLvalue is null. Label must have been defined previously using def_label() (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Return value.  0 on success, -1 on failure.

2.3.23.2.20 NdbInterpretedCode::branch_ge()

Description.  This method compares two register values; if the first is greater than or equal to the second, the interpreted program jumps to the specified label.

Signature. 

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

Parameters.  This method takes three parameters, the registers whose values are to be compared—RegLvalue and RegRvalue—and the program Label to jump to if RegLvalue is greater than or equal to RegRvalue. Label must have been defined previously using def_label() (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Return value.  0 on success, -1 on failure.

2.3.23.2.21 NdbInterpretedCode::branch_gt()

Description.  This method compares two register values; if the first is greater than the second, the interpreted program jumps to the specified label.

Signature. 

int branch_gt
    (
      Uint32 RegLvalue,
      Uint32 RegRvalue,
      Uint32 Label
    )

Parameters.  This method takes three parameters, the registers whose values are to be compared—RegLvalue and RegRvalue—and the program Label to jump to if RegLvalue is greater than RegRvalue. Label must have been defined previously using def_label() (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Return value.  0 on success, -1 on failure.

2.3.23.2.22 NdbInterpretedCode::branch_label()

Description.  This method performs an unconditional jump to an interpreted program label (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Signature. 

int branch_label
    (
      Uint32 Label
    )

Parameters.  This method takes a single parameter, an interpreted program Label defined using def_label().

Return value.  0 on success, -1 on failure.

2.3.23.2.23 NdbInterpretedCode::branch_le()

Description.  This method compares two register values; if the first is less than or equal to the second, the interpreted program jumps to the specified label.

Signature. 

int branch_le
    (
      Uint32 RegLvalue,
      Uint32 RegRvalue,
      Uint32 Label
    )

Parameters.  This method takes three parameters, the registers whose values are to be compared—RegLvalue and RegRvalue—and the program Label to jump to if RegLvalue is less than or equal to RegRvalue. Label must have been defined previously using def_label() (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Return value.  0 on success, -1 on failure.

2.3.23.2.24 NdbInterpretedCode::branch_lt()

Description.  This method compares two register values; if the first is less than the second, the interpreted program jumps to the specified label.

Signature. 

int branch_lt
    (
      Uint32 RegLvalue,
      Uint32 RegRvalue,
      Uint32 Label
    )

Parameters.  This method takes three parameters, the registers whose values are to be compared—RegLvalue and RegRvalue—and the program Label to jump to if RegLvalue is less than RegRvalue. Label must have been defined previously using def_label() (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Return value.  0 on success, -1 on failure.

2.3.23.2.25 NdbInterpretedCode::branch_ne()

Description.  This method compares two register values; if they are not equal, then the interpreted program jumps to the specified label.

Signature. 

int branch_ne
    (
      Uint32 RegLvalue,
      Uint32 RegRvalue,
      Uint32 Label
    )

Parameters.  This method takes three parameters, the registers whose values are to be compared—RegLvalue and RegRvalue—and the program Label to jump they are not equal. Label must have been defined previously using def_label() (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Return value.  0 on success, -1 on failure.

2.3.23.2.26 NdbInterpretedCode::branch_ne_null()

Description.  This method compares a register value with NULL; if the value is not null, then the interpreted program jumps to the specified label.

Signature. 

int branch_ne_null
    (
      Uint32 RegLvalue,
      Uint32 Label
    )

Parameters.  This method takes two parameters, the register whose value is to be compared with NULL (RegLvalue) and the program Label to jump to if RegLvalue is not null. Label must have been defined previously using def_label() (see Section 2.3.23.2.29, “NdbInterpretedCode::def_label()).

Return value.  0 on success, -1 on failure.

2.3.23.2.27 NdbInterpretedCode::call_sub()

Description.  This method is used to call a subroutine.

Signature. 

int call_sub
    (
      Uint32 SubroutineNumber
    )

Parameters.  This method takes a single parameter, the number identifying the subroutine to be called.

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.28 NdbInterpretedCode::copy()

Description.  Makes a deep copy of an NdbInterpretedCode object.

Signature. 

int copy
    (
      const NdbInterpretedCode& src
    )

Parameters.  A reference to the copy.

Return value.  0 on success, or an error code.

2.3.23.2.29 NdbInterpretedCode::def_label()

Description.  This method defines a label to be used as the target of one or more jumps in an interpreted program.

def_label() uses a 2-word buffer and requires no space for request messages.

Signature. 

int def_label
    (
      int LabelNum
    )

Parameters.  This method takes a single parameter LabelNum, whose value must be unique among all values used for labels within the interpreted program.

Return value.  0 on success; -1 on failure.

2.3.23.2.30 NdbInterpretedCode::def_sub()

Description.  This method is used to mark the start of a subroutine. See Section 2.3.23.1.11, “Using Subroutines with NdbInterpretedCode, for more information.

Signature. 

int def_sub
    (
      Uint32 SubroutineNumber
    )

Parameters.  A single parameter, a number used to identify the subroutine.

Return value.  Returns 0 on success, -1 otherwise.

2.3.23.2.31 NdbInterpretedCode::finalise()

Description.  This method prepares an interpreted program, including any subroutines it might have, by resolving all branching instructions and calls to subroutines. It must be called before using the program, and can be invoked only once for any given NdbInterpretedCode object.

If no instructions have been defined, this method attempts to insert a single interpret_exit_ok() method call prior to finalization.

Signature. 

int finalise
    (
      void
    )

Parameters.  None.

Return value.  Returns 0 on success, -1 otherwise.

2.3.23.2.32 NdbInterpretedCode::getNdbError()

Description.  This method returns the most recent error associated with this NdbInterpretedCode object.

Signature. 

const class NdbError& getNdbError
    (
      void
    ) const

Parameters.  None.

Return value.  A reference to an NdbError object.

2.3.23.2.33 NdbInterpretedCode::getTable()

Description.  This method can be used to obtain a reference to the table for which the NdbInterpretedCode object was defined.

Signature. 

const NdbDictionary::Table* getTable
    (
      void
    ) const

Parameters.  None.

Return value.  A pointer to a Table object. Returns NULL if no table object was supplied when the NdbInterpretedCode was instantiated.

2.3.23.2.34 NdbInterpretedCode::getWordsUsed()

Description.  This method returns the number of words from the buffer that have been used, whether the buffer is one that is user-supplied or the internally-provided buffer.

Signature. 

Uint32 getWordsUsed
    (
      void
    ) const

Parameters.  None.

Return value.  The 32-bit number of words used from the buffer.

2.3.23.2.35 NdbInterpretedCode::interpret_exit_last_row()

Description.  For a scanning operation, invoking this method indicates that this row should be returned as part of the scan, and that no more rows in this fragment should be scanned. For other types of operations, the method causes the operation to be aborted.

Signature. 

int interpret_exit_last_row
    (
      void
    )

Parameters.  None.

Return value.  Returns 0 if successful, -1 otherwise.

2.3.23.2.36 NdbInterpretedCode::interpret_exit_nok()

Description.  For scanning operations, this method is used to indicate that the current row should not be returned as part of the scan, and to cause the program should move on to the next row. It causes other types of operations to be aborted.

Signature. 

int interpret_exit_nok
    (
      Uint32 ErrorCode = 626 //  HA_ERR_KEY_NOT_FOUND
    )

Parameters.  This method takes a single (optional) parameter ErrorCode which . For a complete listing of NDB error codes, see Section 7.2.2, “NDB Error Codes and Messages”. If not supplied, defaults to 626 (HA_ERR_KEY_NOT_FOUND/Tuple did not exist. Applications should use error code 626 or another code in the range 6000 to 6999 inclusive.

Prior to MySQL Cluster NDB 7.0.38, MySQL Cluster NDB 7.1.27, and MySQL Cluster NDB 7.2.1, ErrorCode defaulted to NDB error code 899 (Rowid already allocated). This value is still supported for backward compatibility. (Bug #16176006) For any values other than those mentioned here, the behavior of this method is undefined, and is subject to change at any time without prior notice.

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.37 NdbInterpretedCode::interpret_exit_ok()

Description.  For a scanning operation, this method indicates that the current row should be returned as part of the results of the scan and that the program should move on to the next row. For other operations, calling this method causes the interpreted program to exit.

Signature. 

int interpret_exit_ok
    (
      void
    )

Parameters.  None.

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.38 NdbInterpretedCode::load_const_null()

Description.  This method is used to load a NULL value into a register.

Signature. 

int load_const_null
    (
      Uint32 RegDest
    )

Parameters.  This method takes a single parameter, the register into which to place the NULL.

Return value.  Returns 0 on success, -1 otherwise.

2.3.23.2.39 NdbInterpretedCode::load_const_u16()

Description.  This method loads a 16-bit value into the specified interpreter register.

Signature. 

int load_const_u16
    (
      Uint32 RegDest,
      Uint32 Constant
    )

Parameters.  This method takes the following two parameters:

  • RegDest: The register into which the value should be loaded.

  • A Constant value to be loaded

Return value.  Returns 0 on success, -1 otherwise.

2.3.23.2.40 NdbInterpretedCode::load_const_u32()

Description.  This method loads a 32-bit value into the specified interpreter register.

Signature. 

int load_const_u32
    (
      Uint32 RegDest,
      Uint32 Constant
    )

Parameters.  This method takes the following two parameters:

  • RegDest: The register into which the value should be loaded.

  • A Constant value to be loaded

Return value.  Returns 0 on success, -1 otherwise.

2.3.23.2.41 NdbInterpretedCode::load_const_u64()

Description.  This method loads a 64-bit value into the specified interpreter register.

Signature. 

int load_const_u64
    (
      Uint32 RegDest,
      Uint64 Constant
    )

Parameters.  This method takes the following two parameters:

  • RegDest: The register into which the value should be loaded.

  • A Constant value to be loaded

Return value.  Returns 0 on success, -1 otherwise.

2.3.23.2.42 NdbInterpretedCode::read_attr()

Description.  The read_attr() method is used to read a table column value into a program register. The column may be specified either by using its attribute ID or as a pointer to a Column object.

Signature.  This method can be called in either of two ways. The first of these is by referencing the column by its attribute ID, as shown here:

int read_attr
    (
      Uint32 RegDest,
      Uint32 attrId
    )

Alternatively, you can reference the column as a Column object, as shown here:

int read_attr
    (
      Uint32 RegDest,
      const NdbDictionary::Column* column
    )

Parameters.  This method takes two parameters, as described here:

  • The register to which the column value is to be copied (RegDest).

  • Either of the following references to the table column whose value is to be copied:

    • The table column's attribute ID (attrId)

    • A pointer to a column—that is, a pointer to an Column object referencing the table column

Return value.  Returns 0 on success, and -1 on failure.

2.3.23.2.43 NdbInterpretedCode::ret_sub()

Description.  This method marks the end of the current subroutine.

Signature. 

int ret_sub
    (
      void
    )

Parameters.  None.

Return value.  Returns 0 on success, -1 otherwise.

2.3.23.2.44 NdbInterpretedCode::sub_reg()

Description.  This method gets the difference between the values stored in any two given registers and stores the result in a third register.

Signature. 

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

Parameters.  This method takes three parameters. The first of these is the register in which the result is to be stored (RegDest). The second and third parameters (RegSource1and RegSource2) are the registers whose values are to be subtracted. In other words, the value of register RegDest is calculated as the value of the expression shown here:

(value in register RegSource1) – (value in register RegSource2)
Note

It is possible to re-use one of the registers whose values are subtracted for storing the result; that is, RegDest can be the same as RegSource1 or RegSource2.

Return value.  0 on success; -1 on failure.

2.3.23.2.45 NdbInterpretedCode::sub_val()

Description.  This method subtracts a specified value from the value of a given table column, and places the original and modified column values in registers 6 and 7. It is equivalent to the following series of NdbInterpretedCode method calls, where attrId is the table column' attribute ID and aValue is the value to be subtracted:

read_attr(6, attrId);
load_const_u32(7, aValue);
sub_reg(7,6,7);
write_attr(attrId, 7);

aValue can be a 32-bit or 64-bit integer.

Signature.  This method can be invoked in either of two ways, depending on whether aValue is 32-bit or 64-bit.

32-bit aValue:

int sub_val
    (
      Uint32 attrId,
      Uint32 aValue
    )

64-bit aValue:

int sub_val
    (
      Uint32 attrId,
      Uint64 aValue
    )

Parameters.  A table column attribute ID and a 32-bit or 64-bit integer value to be subtracted from this column value.

Return value.  Returns 0 on success, -1 on failure.

2.3.23.2.46 NdbInterpretedCode::write_attr()

Description.  This method is used to copy a register value to a table column. The column may be specified either by using its attribute ID or as a pointer to a Column object.

Signature.  This method can be invoked in either of two ways. The first of these is requires referencing the column by its attribute ID, as shown here:

int read_attr
    (
      Uint32 attrId,
      Uint32 RegSource
    )

You can also reference the column as a Column object instead, like this:

int read_attr
    (
      const NdbDictionary::Column* column,
      Uint32 RegSource
    )

Parameters.  This method takes two parameters as follows:

  • A reference to the table column to which the register value is to be copied. This can be either of the following:

    • The table column's attribute ID (attrId)

    • A pointer to a column—that is, a pointer to an Column object referencing the table column

  • The register whose value is to be copied (RegSource).

Return value.  Returns 0 on success; -1 on failure.