Commit 5d1d1057 authored by Georgi Kodinov's avatar Georgi Kodinov
Browse files

Bug #32124 addendum

 Fixed the handling of system variable retrieval
in prepared statements : added a cleanup method
that clears up the cache and restores the 
original scope of the variable (which is overwritten
at fix_fields()).
parent 8c6ffe36
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -4800,8 +4800,8 @@ Item_func_get_system_var::
Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
                       LEX_STRING *component_arg, const char *name_arg,
                       size_t name_len_arg)
  :var(var_arg), var_type(var_type_arg), component(*component_arg), 
   cache_present(0)
  :var(var_arg), var_type(var_type_arg), orig_var_type(var_type_arg),
  component(*component_arg), cache_present(0)
{
  /* set_name() will allocate the name */
  set_name(name_arg, name_len_arg, system_charset_info);
@@ -5186,6 +5186,15 @@ bool Item_func_get_system_var::eq(const Item *item, bool binary_cmp) const
}


void Item_func_get_system_var::cleanup()
{
  Item_func::cleanup();
  cache_present= NULL;
  var_type= orig_var_type;
  cached_strval.free();
}


longlong Item_func_inet_aton::val_int()
{
  DBUG_ASSERT(fixed == 1);
+3 −1
Original line number Diff line number Diff line
@@ -1433,7 +1433,7 @@ class Item_user_var_as_out_param :public Item
class Item_func_get_system_var :public Item_func
{
  sys_var *var;
  enum_var_type var_type;
  enum_var_type var_type, orig_var_type;
  LEX_STRING component;
  longlong cached_llval;
  double cached_dval;
@@ -1468,6 +1468,8 @@ class Item_func_get_system_var :public Item_func
  */
  bool is_written_to_binlog();
  bool eq(const Item *item, bool binary_cmp) const;

  void cleanup();
};