19 #ifndef NdbInterpretedCode_H
20 #define NdbInterpretedCode_H
22 #include <ndb_types.h>
23 #include "ndbapi_limits.h"
25 #include "NdbDictionary.hpp"
26 #include "NdbError.hpp"
94 Uint32 buffer_word_size= 0);
113 int load_const_null(Uint32 RegDest);
114 int load_const_u16(Uint32 RegDest, Uint32 Constant);
115 int load_const_u32(Uint32 RegDest, Uint32 Constant);
116 int load_const_u64(Uint32 RegDest, Uint64 Constant);
137 int read_attr(Uint32 RegDest, Uint32 attrId);
139 int write_attr(Uint32 attrId, Uint32 RegSource);
158 int add_reg(Uint32 RegDest, Uint32 RegSource1, Uint32 RegSource2);
159 int sub_reg(Uint32 RegDest, Uint32 RegSource1, Uint32 RegSource2);
173 int def_label(
int LabelNum);
183 int branch_label(Uint32 Label);
201 int branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
202 int branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
203 int branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
204 int branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
205 int branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
206 int branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
207 int branch_ne_null(Uint32 RegLvalue, Uint32 Label);
208 int branch_eq_null(Uint32 RegLvalue, Uint32 Label);
244 int branch_col_eq(
const void * val, Uint32 unused, Uint32 attrId,
246 int branch_col_ne(
const void * val, Uint32 unused, Uint32 attrId,
248 int branch_col_lt(
const void * val, Uint32 unused, Uint32 attrId,
250 int branch_col_le(
const void * val, Uint32 unused, Uint32 attrId,
252 int branch_col_gt(
const void * val, Uint32 unused, Uint32 attrId,
254 int branch_col_ge(
const void * val, Uint32 unused, Uint32 attrId,
256 int branch_col_eq_null(Uint32 attrId, Uint32 Label);
257 int branch_col_ne_null(Uint32 attrId, Uint32 Label);
291 int branch_col_like(
const void * val, Uint32 len, Uint32 attrId,
293 int branch_col_notlike(
const void * val, Uint32 len, Uint32 attrId,
337 int branch_col_and_mask_eq_mask(
const void * mask, Uint32 unused, Uint32 attrId, Uint32 Label);
338 int branch_col_and_mask_ne_mask(
const void * mask, Uint32 unused, Uint32 attrId, Uint32 Label);
339 int branch_col_and_mask_eq_zero(
const void * mask, Uint32 unused, Uint32 attrId, Uint32 Label);
340 int branch_col_and_mask_ne_zero(
const void * mask, Uint32 unused, Uint32 attrId, Uint32 Label);
364 int interpret_exit_ok();
379 int interpret_exit_nok(Uint32 ErrorCode);
380 int interpret_exit_nok();
394 int interpret_exit_last_row();
422 int add_val(Uint32 attrId, Uint32 aValue);
423 int add_val(Uint32 attrId, Uint64 aValue);
445 int sub_val(Uint32 attrId, Uint32 aValue);
446 int sub_val(Uint32 attrId, Uint64 aValue);
471 int def_sub(Uint32 SubroutineNumber);
487 int call_sub(Uint32 SubroutineNumber);
547 friend class NdbQueryOptionsImpl;
549 static const Uint32 MaxReg= 8;
550 static const Uint32 MaxLabels= 65535;
551 static const Uint32 MaxSubs=65535;
552 static const Uint32 MaxDynamicBufSize= NDB_MAX_SCANFILTER_SIZE_IN_WORDS;
556 Uint32 m_buffer_length;
557 Uint32 *m_internal_buffer;
558 Uint32 m_number_of_labels;
559 Uint32 m_number_of_subs;
560 Uint32 m_number_of_calls;
565 Uint32 m_last_meta_pos;
570 Uint32 m_instructions_length;
575 Uint32 m_first_sub_instruction_pos;
584 Uint32 m_available_length;
596 InSubroutineDef= 0x4,
631 Uint16 firstInstrPos;
636 static const Uint32 CODEMETAINFO_WORDS = 2;
641 TooManyInstructions = 4518,
642 BadAttributeId = 4004,
644 BranchToBadLabel = 4221,
650 int error(Uint32
code);
651 bool have_space_for(Uint32 wordsRequired);
654 int add2(Uint32 x1, Uint32 x2);
655 int add3(Uint32 x1, Uint32 x2, Uint32 x3);
656 int addN(Uint32 *data, Uint32 length);
657 int addMeta(CodeMetaInfo& info);
659 int add_branch(Uint32 instruction, Uint32 Label);
661 int write_attr_impl(
const NdbColumnImpl *c, Uint32 RegSource);
662 int branch_col(Uint32 branch_type, Uint32 attrId,
const void * val,
663 Uint32 len, Uint32 label);
664 int getInfo(Uint32 number, CodeMetaInfo &info)
const;
665 static int compareMetaInfo(
const void *a,