2.3.24 The NdbInterpretedCode Class Using NdbInterpretedCode NdbInterpretedCode Constructor NdbInterpretedCode::add_reg() NdbInterpretedCode::add_val() NdbInterpretedCode::branch_col_and_mask_eq_mask() NdbInterpretedCode::branch_col_and_mask_eq_zero() NdbInterpretedCode::branch_col_and_mask_ne_mask() NdbInterpretedCode::branch_col_and_mask_ne_zero() NdbInterpretedCode::branch_col_eq() NdbInterpretedCode::branch_col_eq_null() NdbInterpretedCode::branch_col_ge() NdbInterpretedCode::branch_col_gt() NdbInterpretedCode::branch_col_le() NdbInterpretedCode::branch_col_like() NdbInterpretedCode::branch_col_lt() NdbInterpretedCode::branch_col_ne() NdbInterpretedCode::branch_col_ne_null() NdbInterpretedCode::branch_col_notlike() NdbInterpretedCode::branch_eq() NdbInterpretedCode::branch_eq_null() NdbInterpretedCode::branch_ge() NdbInterpretedCode::branch_gt() NdbInterpretedCode::branch_label() NdbInterpretedCode::branch_le() NdbInterpretedCode::branch_lt() NdbInterpretedCode::branch_ne() NdbInterpretedCode::branch_ne_null() NdbInterpretedCode::call_sub() NdbInterpretedCode::copy() NdbInterpretedCode::def_label() NdbInterpretedCode::def_sub() NdbInterpretedCode::finalise() NdbInterpretedCode::getNdbError() NdbInterpretedCode::getTable() NdbInterpretedCode::getWordsUsed() NdbInterpretedCode::interpret_exit_last_row() NdbInterpretedCode::interpret_exit_nok() NdbInterpretedCode::interpret_exit_ok() NdbInterpretedCode::load_const_null() NdbInterpretedCode::load_const_u16() NdbInterpretedCode::load_const_u32() NdbInterpretedCode::load_const_u64() NdbInterpretedCode::read_attr() NdbInterpretedCode::ret_sub() NdbInterpretedCode::sub_reg() NdbInterpretedCode::sub_val() NdbInterpretedCode::write_attr()


This section discusses the NdbInterpretedCode class, which can be used to prepare and execute an NDB API interpreted program.

Parent class.  None.

Child classes.  None.

Description.  NdbInterpretedCode represents an interpreted program for use in operations created using NdbRecord, or with scans created using the old API. The NdbScanFilter class can also be used to generate an NDB interpreted program using this class.


This interface is still under development, and so is subject to change without notice. The NdbScanFilter API is a more stable API for defining scanning and filtering programs.

Using NdbInterpretedCode.  To create an NdbInterpretedCode object, invoke the constructor, optionally supplying a table for the program to operate on, and a buffer for program storage and finalization. If no table is supplied, then only instructions which do not access table attributes can be used.


Each NDB API operation applies to one table, and so does any NdbInterpretedCode program attached to that operation.

If no buffer is supplied, then an internal buffer is dynamically allocated and extended as necessary. Once the NdbInterpretedCode object is created, you can add instructions and labels to it by calling the appropriate methods as described later in this section. When the program has completed, finalize it by calling the finalise() method, which resolves any remaining internal branches and calls to label and subroutine offsets.


A single finalized NdbInterpretedCode program can be used by more than one operation. It need not be re-prepared for successive operations.

To use the program with NdbRecord operations and scans, pass it at operation definition time using the OperationOptions or ScanOptions parameter. When the program is no longer required, the NdbInterpretedCode object can be deleted, along with any user-supplied buffer.

Error checking.  For reasons of efficiency, methods of this class provide minimal error checking.

Methods.  The following table lists the public methods of this class and the purpose or use of each method:

MethodPurpose / Use
NdbInterpretedCode()Class constructor
add_reg()Add two register values and store the result in a third register
add_val()Add a value to a table column value
branch_col_and_mask_eq_mask()Jump if a column value ANDed with a bitmask is equal to the bitmask
branch_col_and_mask_eq_zero()Jump if a column value ANDed with a bitmask is equal to 0
branch_col_and_mask_ne_mask()Jump if a column value ANDed with a bitmask is not equal to the bitmask
branch_col_and_mask_ne_zero()Jump if a column value ANDed with a bitmask is not equal to 0
branch_col_eq()Jump if a column value is equal to another
branch_col_eq_null()Jump if a column value is NULL
branch_col_ge()Jump if a column value is greater than or equal to another
branch_col_gt()Jump if a column value is greater than another
branch_col_le()Jump if a column value is less than or equal to another
branch_col_like()Jump if a column value matches a pattern
branch_col_lt()Jump if a column value is less than another
branch_col_ne()Jump if a column value is not equal to another
branch_col_ne_null()Jump if a column value is not NULL
branch_col_notlike()Jump if a column value does not match a pattern
branch_eq()Jump if one register value is equal to another
branch_eq_null()Jump if a register value is NULL
branch_ge()Jump if one register value is greater than or equal to another
branch_gt()Jump if one register value is greater than another
branch_label()Unconditional jump to a label
branch_le()Jump if one register value is less than or equal to another
branch_lt()Jump if one register value is less than another
branch_ne()Jump if one register value is not equal to another
branch_ne_null()Jump if a register value is not NULL
call_sub()Call a subroutine
copy()Make a deep copy of an NdbInterpretedCode object
def_label()Create a label for use within the interpreted program
def_sub()Define a subroutine
finalise()Completes interpreted program and prepares it for use
getNdbError()Gets the most recent error associated with this NdbInterpretedCode object
getTable()Gets the table on which the program is defined
getWordsUsed()Gets the number of words used in the buffer
interpret_exit_last_row()Return a row as part of the result, and do not check any more rows in this fragment
interpret_exit_nok()Do not return a row as part of the result
interpret_exit_ok()Return a row as part of the result
load_const_null()Load a NULL value into a register
load_const_u16()Load a 16-bit numeric value into a register
load_const_u32()Load a 32-bit numeric value into a register
load_const_u64()Load a 64-bit numeric value into a register
read_attr()Read a register value into a table column
ret_sub()Return from a subroutine
sub_reg()Subtract two register values and store the result in a third register
sub_val()Subtract a value from a table column value
write_attr()Write a table column value into a register

See also Section, “Using NdbInterpretedCode”.

Types.  This class defines no public types.

Class diagram.  This diagram shows all the available methods of the NdbInterpretedCode class:

Figure 2.19 NdbInterpretedCode

Public methods of the NdbInterpretedCode class.