diff options
Diffstat (limited to 'sql/item.h')
-rw-r--r-- | sql/item.h | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/sql/item.h b/sql/item.h index 2a7b92dd601..42442468be9 100644 --- a/sql/item.h +++ b/sql/item.h @@ -367,6 +367,39 @@ typedef enum monotonicity_info class sp_rcontext; +class Sp_rcontext_handler +{ +public: + virtual ~Sp_rcontext_handler() {} + virtual const LEX_CSTRING *get_name_prefix() const= 0; + virtual sp_rcontext *get_rcontext(sp_rcontext *ctx) const= 0; +}; + + +class Sp_rcontext_handler_local: public Sp_rcontext_handler +{ +public: + const LEX_CSTRING *get_name_prefix() const; + sp_rcontext *get_rcontext(sp_rcontext *ctx) const; +}; + + +class Sp_rcontext_handler_package_body: public Sp_rcontext_handler +{ +public: + const LEX_CSTRING *get_name_prefix() const; + sp_rcontext *get_rcontext(sp_rcontext *ctx) const; +}; + + +extern MYSQL_PLUGIN_IMPORT + Sp_rcontext_handler_local sp_rcontext_handler_local; + + +extern MYSQL_PLUGIN_IMPORT + Sp_rcontext_handler_package_body sp_rcontext_handler_package_body; + + class Item_equal; @@ -2384,13 +2417,20 @@ class Item_splocal :public Item_sp_variable, public Type_handler_hybrid_field_type { protected: + const Sp_rcontext_handler *m_rcontext_handler; + uint m_var_idx; Type m_type; bool append_value_for_log(THD *thd, String *str); + + sp_rcontext *get_rcontext(sp_rcontext *local_ctx) const; + Item_field *get_variable(sp_rcontext *ctx) const; + public: - Item_splocal(THD *thd, const LEX_CSTRING *sp_var_name, uint sp_var_idx, + Item_splocal(THD *thd, const Sp_rcontext_handler *rh, + const LEX_CSTRING *sp_var_name, uint sp_var_idx, const Type_handler *handler, uint pos_in_q= 0, uint len_in_q= 0); @@ -2452,10 +2492,11 @@ class Item_splocal_with_delayed_data_type: public Item_splocal { public: Item_splocal_with_delayed_data_type(THD *thd, + const Sp_rcontext_handler *rh, const LEX_CSTRING *sp_var_name, uint sp_var_idx, uint pos_in_q, uint len_in_q) - :Item_splocal(thd, sp_var_name, sp_var_idx, &type_handler_null, + :Item_splocal(thd, rh, sp_var_name, sp_var_idx, &type_handler_null, pos_in_q, len_in_q) { } }; @@ -2474,13 +2515,13 @@ protected: bool set_value(THD *thd, sp_rcontext *ctx, Item **it); public: Item_splocal_row_field(THD *thd, + const Sp_rcontext_handler *rh, const LEX_CSTRING *sp_var_name, const LEX_CSTRING *sp_field_name, uint sp_var_idx, uint sp_field_idx, const Type_handler *handler, uint pos_in_q= 0, uint len_in_q= 0) - :Item_splocal(thd, sp_var_name, sp_var_idx, handler, - pos_in_q, len_in_q), + :Item_splocal(thd, rh, sp_var_name, sp_var_idx, handler, pos_in_q, len_in_q), m_field_name(*sp_field_name), m_field_idx(sp_field_idx) { } @@ -2498,12 +2539,13 @@ class Item_splocal_row_field_by_name :public Item_splocal_row_field bool set_value(THD *thd, sp_rcontext *ctx, Item **it); public: Item_splocal_row_field_by_name(THD *thd, + const Sp_rcontext_handler *rh, const LEX_CSTRING *sp_var_name, const LEX_CSTRING *sp_field_name, uint sp_var_idx, const Type_handler *handler, uint pos_in_q= 0, uint len_in_q= 0) - :Item_splocal_row_field(thd, sp_var_name, sp_field_name, + :Item_splocal_row_field(thd, rh, sp_var_name, sp_field_name, sp_var_idx, 0 /* field index will be set later */, handler, pos_in_q, len_in_q) { } |