diff options
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r-- | sql/sp_head.h | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/sql/sp_head.h b/sql/sp_head.h index 791c6697693..cb2e56adabe 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -79,6 +79,7 @@ public: int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE enum enum_field_types m_returns; // For FUNCTIONs only + CHARSET_INFO *m_returns_cs; // For FUNCTIONs only my_bool m_has_return; // For FUNCTIONs only my_bool m_simple_case; // TRUE if parsing simple case, FALSE otherwise my_bool m_multi_results; // TRUE if a procedure with SELECT(s) @@ -262,12 +263,9 @@ public: // instruction to execute. (For most instruction this will be the // instruction following this one.) // Returns 0 on success, non-zero if some error occured. - virtual int - execute(THD *thd, uint *nextp) - { // Default is a no-op. - *nextp = m_ip+1; // Next instruction - return 0; - } + virtual int execute(THD *thd, uint *nextp) = 0; + + virtual void print(String *str) = 0; protected: @@ -294,6 +292,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + inline void set_lex(LEX *lex) { @@ -333,6 +333,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: uint m_offset; // Frame offset @@ -350,7 +352,7 @@ class sp_instr_jump : public sp_instr public: sp_instr_jump(uint ip) - : sp_instr(ip) + : sp_instr(ip), m_dest(0) {} sp_instr_jump(uint ip, uint dest) @@ -362,10 +364,13 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + virtual void set_destination(uint dest) { - m_dest= dest; + if (m_dest == 0) // Don't reset + m_dest= dest; } protected: @@ -395,6 +400,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: Item *m_expr; // The condition @@ -422,6 +429,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: Item *m_expr; // The condition @@ -445,6 +454,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + protected: Item *m_value; @@ -474,6 +485,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + inline void add_condition(struct sp_cond_type *cond) { m_cond.push_front(cond); @@ -505,6 +518,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: uint m_count; @@ -528,6 +543,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: uint m_frame; @@ -550,6 +567,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: LEX *m_lex; @@ -573,6 +592,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: uint m_count; @@ -596,6 +617,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: uint m_cursor; // Stack index @@ -619,6 +642,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + private: uint m_cursor; @@ -644,6 +669,8 @@ public: virtual int execute(THD *thd, uint *nextp); + virtual void print(String *str); + void add_to_varlist(struct sp_pvar *var) { m_varlist.push_back(var); @@ -657,6 +684,31 @@ private: }; // class sp_instr_cfetch : public sp_instr +class sp_instr_error : public sp_instr +{ + sp_instr_error(const sp_instr_error &); /* Prevent use of these */ + void operator=(sp_instr_error &); + +public: + + sp_instr_error(uint ip, int errcode) + : sp_instr(ip), m_errcode(errcode) + {} + + virtual ~sp_instr_error() + {} + + virtual int execute(THD *thd, uint *nextp); + + virtual void print(String *str); + +private: + + int m_errcode; + +}; // class sp_instr_error : public sp_instr + + struct st_sp_security_context { bool changed; |