NdbInterpretedCode Class Reference

#include <NdbInterpretedCode.hpp>

List of all members.

Classes

struct  CodeMetaInfo

Public Member Functions

 NdbInterpretedCode (const NdbDictionary::Table *table=0, Uint32 *buffer=0, Uint32 buffer_word_size=0)
 ~NdbInterpretedCode ()
int load_const_null (Uint32 RegDest)
int load_const_u16 (Uint32 RegDest, Uint32 Constant)
int load_const_u32 (Uint32 RegDest, Uint32 Constant)
int load_const_u64 (Uint32 RegDest, Uint64 Constant)
int read_attr (Uint32 RegDest, Uint32 attrId)
int read_attr (Uint32 RegDest, const NdbDictionary::Column *column)
int write_attr (Uint32 attrId, Uint32 RegSource)
int write_attr (const NdbDictionary::Column *column, Uint32 RegSource)
int add_reg (Uint32 RegDest, Uint32 RegSource1, Uint32 RegSource2)
int sub_reg (Uint32 RegDest, Uint32 RegSource1, Uint32 RegSource2)
int def_label (int LabelNum)
int branch_label (Uint32 Label)
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_col_eq (const void *val, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_ne (const void *val, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_lt (const void *val, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_le (const void *val, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_gt (const void *val, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_ge (const void *val, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_eq_null (Uint32 attrId, Uint32 Label)
int branch_col_ne_null (Uint32 attrId, Uint32 Label)
int branch_col_like (const void *val, Uint32 len, Uint32 attrId, Uint32 Label)
int branch_col_notlike (const void *val, Uint32 len, Uint32 attrId, Uint32 Label)
int branch_col_and_mask_eq_mask (const void *mask, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_and_mask_ne_mask (const void *mask, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_and_mask_eq_zero (const void *mask, Uint32 unused, Uint32 attrId, Uint32 Label)
int branch_col_and_mask_ne_zero (const void *mask, Uint32 unused, Uint32 attrId, Uint32 Label)
int interpret_exit_ok ()
int interpret_exit_nok (Uint32 ErrorCode)
int interpret_exit_nok ()
int interpret_exit_last_row ()
int add_val (Uint32 attrId, Uint32 aValue)
int add_val (Uint32 attrId, Uint64 aValue)
int sub_val (Uint32 attrId, Uint32 aValue)
int sub_val (Uint32 attrId, Uint64 aValue)
int def_sub (Uint32 SubroutineNumber)
int call_sub (Uint32 SubroutineNumber)
int ret_sub ()
int finalise ()
const NdbDictionary::TablegetTable () const
struct NdbErrorgetNdbError () const
Uint32 getWordsUsed () const

Private Types

enum  Flags { GotError = 0x1, UsesDisk = 0x2, InSubroutineDef = 0x4, Finalised = 0x8 }
enum  InfoType { Label = 0, Subroutine = 1 }
enum  Errors {
  TooManyInstructions = 4518, BadAttributeId = 4004, BadLabelNum = 4226, BranchToBadLabel = 4221,
  BadLength = 4209, BadSubNumber = 4227, BadState = 4231
}

Private Member Functions

int error (Uint32 code)
bool have_space_for (Uint32 wordsRequired)
int add1 (Uint32 x1)
int add2 (Uint32 x1, Uint32 x2)
int add3 (Uint32 x1, Uint32 x2, Uint32 x3)
int addN (Uint32 *data, Uint32 length)
int addMeta (CodeMetaInfo &info)
int add_branch (Uint32 instruction, Uint32 Label)
int read_attr_impl (const NdbColumnImpl *c, Uint32 RegDest)
int write_attr_impl (const NdbColumnImpl *c, Uint32 RegSource)
int branch_col (Uint32 branch_type, Uint32 attrId, const void *val, Uint32 len, Uint32 label)
int getInfo (Uint32 number, CodeMetaInfo &info) const
 NdbInterpretedCode (const NdbInterpretedCode &)
NdbInterpretedCodeoperator= (const NdbInterpretedCode &)

Static Private Member Functions

static int compareMetaInfo (const void *a, const void *b)

Private Attributes

const NdbTableImpl * m_table_impl
Uint32 * m_buffer
Uint32 m_buffer_length
Uint32 * m_internal_buffer
Uint32 m_number_of_labels
Uint32 m_number_of_subs
Uint32 m_number_of_calls
Uint32 m_last_meta_pos
Uint32 m_instructions_length
Uint32 m_first_sub_instruction_pos
Uint32 m_available_length
Uint32 m_flags
NdbError m_error

Static Private Attributes

static const Uint32 MaxReg = 8
static const Uint32 MaxLabels = 65535
static const Uint32 MaxSubs = 65535
static const Uint32 MaxDynamicBufSize = NDB_MAX_SCANFILTER_SIZE_IN_WORDS
static const Uint32 CODEMETAINFO_WORDS = 2

Friends

class NdbOperation
class NdbScanOperation


Member Enumeration Documentation

Enumerator:
TooManyInstructions 
BadAttributeId 
BadLabelNum 
BranchToBadLabel 
BadLength 
BadSubNumber 
BadState 

enum NdbInterpretedCode::Flags [private]

Enumerator:
GotError 
UsesDisk 
InSubroutineDef 
Finalised 

Enumerator:
Label 
Subroutine 


Constructor & Destructor Documentation

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

NdbInterpretedCode constructor

Parameters:
table The table which this program will be run against. This parameter must be supplied if the program is table specific (i.e. reads from or writes to columns in the table).
buffer Pointer to a buffer of 32bit words used to store the program.
buffer_word_size 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.

NdbInterpretedCode::~NdbInterpretedCode (  ) 

NdbInterpretedCode::NdbInterpretedCode ( const NdbInterpretedCode  )  [private]


Member Function Documentation

int NdbInterpretedCode::add1 ( Uint32  x1  )  [private]

int NdbInterpretedCode::add2 ( Uint32  x1,
Uint32  x2 
) [private]

int NdbInterpretedCode::add3 ( Uint32  x1,
Uint32  x2,
Uint32  x3 
) [private]

int NdbInterpretedCode::add_branch ( Uint32  instruction,
Uint32  Label 
) [private]

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

int NdbInterpretedCode::add_val ( Uint32  attrId,
Uint64  aValue 
)

int NdbInterpretedCode::add_val ( Uint32  attrId,
Uint32  aValue 
)

int NdbInterpretedCode::addMeta ( CodeMetaInfo info  )  [private]

int NdbInterpretedCode::addN ( Uint32 *  data,
Uint32  length 
) [private]

int NdbInterpretedCode::branch_col ( Uint32  branch_type,
Uint32  attrId,
const void *  val,
Uint32  len,
Uint32  label 
) [private]

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

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

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

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

int NdbInterpretedCode::branch_col_eq ( const void *  val,
Uint32  unused,
Uint32  attrId,
Uint32  Label 
)

int NdbInterpretedCode::branch_col_eq_null ( Uint32  attrId,
Uint32  Label 
)

int NdbInterpretedCode::branch_col_ge ( const void *  val,
Uint32  unused,
Uint32  attrId,
Uint32  Label 
)

int NdbInterpretedCode::branch_col_gt ( const void *  val,
Uint32  unused,
Uint32  attrId,
Uint32  Label 
)

int NdbInterpretedCode::branch_col_le ( const void *  val,
Uint32  unused,
Uint32  attrId,
Uint32  Label 
)

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

int NdbInterpretedCode::branch_col_lt ( const void *  val,
Uint32  unused,
Uint32  attrId,
Uint32  Label 
)

int NdbInterpretedCode::branch_col_ne ( const void *  val,
Uint32  unused,
Uint32  attrId,
Uint32  Label 
)

int NdbInterpretedCode::branch_col_ne_null ( Uint32  attrId,
Uint32  Label 
)

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

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

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

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

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

int NdbInterpretedCode::branch_label ( Uint32  Label  ) 

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

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

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

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

int NdbInterpretedCode::call_sub ( Uint32  SubroutineNumber  ) 

call_sub Call a subroutine by number. When the subroutine returns, the program will continue executing at the next instruction. Subroutines can be called from the main program, or from subroutines. The maximum stack depth is currently 32.

Space required Buffer Request message call_sub 1 word 1 word

Parameters:
SubroutineNumber Which subroutine to call
Returns:
0 if successful, -1 otherwise

static int NdbInterpretedCode::compareMetaInfo ( const void *  a,
const void *  b 
) [static, private]

int NdbInterpretedCode::def_label ( int  LabelNum  ) 

int NdbInterpretedCode::def_sub ( Uint32  SubroutineNumber  ) 

def_subroutine Define a subroutine. Subroutines can only be defined after all main program instructions are defined. Instructions following this, up to the next ret_sub() instruction are part of this subroutine. Subroutine numbers must be contiguous from zero but do not have to be in order.

Space required Buffer Request message def_sub 2 words 0 words

Parameters:
SubroutineNumber number to identify this subroutine
Returns:
0 if successful, -1 otherwise

int NdbInterpretedCode::error ( Uint32  code  )  [private]

int NdbInterpretedCode::finalise (  ) 

finalise This method must be called after an Interpreted program is defined and before it is used. It uses the label and subroutine meta information to resolve branch jumps and subroutine calls. It can only be called once. If no instructions have been defined, then it will attempt to add a single interpret_exit_ok instruction before finalisation.

int NdbInterpretedCode::getInfo ( Uint32  number,
CodeMetaInfo info 
) const [private]

struct NdbError& NdbInterpretedCode::getNdbError (  )  const [read]

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

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

getTable() Returns a pointer to the table object representing the table that this NdbInterpretedCode object operates on. This can be NULL if no table object was supplied at construction time.

Uint32 NdbInterpretedCode::getWordsUsed (  )  const

getWordsUsed Returns the number of words of the supplied or internal buffer that have been used.

bool NdbInterpretedCode::have_space_for ( Uint32  wordsRequired  )  [private]

int NdbInterpretedCode::interpret_exit_last_row (  ) 

int NdbInterpretedCode::interpret_exit_nok (  ) 

int NdbInterpretedCode::interpret_exit_nok ( Uint32  ErrorCode  ) 

int NdbInterpretedCode::interpret_exit_ok (  ) 

int NdbInterpretedCode::load_const_null ( Uint32  RegDest  ) 

int NdbInterpretedCode::load_const_u16 ( Uint32  RegDest,
Uint32  Constant 
)

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

int NdbInterpretedCode::load_const_u64 ( Uint32  RegDest,
Uint64  Constant 
)

NdbInterpretedCode& NdbInterpretedCode::operator= ( const NdbInterpretedCode  )  [private]

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

int NdbInterpretedCode::read_attr ( Uint32  RegDest,
Uint32  attrId 
)

int NdbInterpretedCode::read_attr_impl ( const NdbColumnImpl *  c,
Uint32  RegDest 
) [private]

int NdbInterpretedCode::ret_sub (  ) 

ret_sub Return from a subroutine.

Space required Buffer Request message ret_sub 1 word 1 word

Returns:
0 if successful, -1 otherwise

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

int NdbInterpretedCode::sub_val ( Uint32  attrId,
Uint64  aValue 
)

int NdbInterpretedCode::sub_val ( Uint32  attrId,
Uint32  aValue 
)

int NdbInterpretedCode::write_attr ( const NdbDictionary::Column column,
Uint32  RegSource 
)

int NdbInterpretedCode::write_attr ( Uint32  attrId,
Uint32  RegSource 
)

int NdbInterpretedCode::write_attr_impl ( const NdbColumnImpl *  c,
Uint32  RegSource 
) [private]


Friends And Related Function Documentation

friend class NdbOperation [friend]

friend class NdbScanOperation [friend]


Member Data Documentation

const Uint32 NdbInterpretedCode::CODEMETAINFO_WORDS = 2 [static, private]

Uint32* NdbInterpretedCode::m_buffer [private]

Uint32 NdbInterpretedCode::m_flags [private]

const NdbTableImpl* NdbInterpretedCode::m_table_impl [private]

const Uint32 NdbInterpretedCode::MaxDynamicBufSize = NDB_MAX_SCANFILTER_SIZE_IN_WORDS [static, private]

const Uint32 NdbInterpretedCode::MaxLabels = 65535 [static, private]

const Uint32 NdbInterpretedCode::MaxReg = 8 [static, private]

const Uint32 NdbInterpretedCode::MaxSubs = 65535 [static, private]


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

MySQL Cluster Database Blog

Based on MySQL Cluster 7.0.7.

This page is for information only and is not maintained by MySQL or Sun Microsystems - use at your own risk. For an upto date view of the API refer to the header files included with your MySQL Cluster distribution or check the MySQL Cluster API Developer Guide.