MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:October 9 2008 3:03pm
Subject:bzr commit into mysql-5.1 branch (kgeorge:2770) Bug#32124
View as plain text  
#At file:///home/kgeorge/mysql/bzr/B32124-5.1-bugteam/

 2770 Georgi Kodinov	2008-10-09
      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()).
modified:
  sql/item_func.cc
  sql/item_func.h

per-file messages:
  sql/item_func.cc
    ug #32124: 
     - preserve the requested variable scope
     - clean up the cache and restore the variable
       scope for prepared statements.
  sql/item_func.h
    Bug #32124: preserve the requested variable scope
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2008-10-08 11:23:53 +0000
+++ b/sql/item_func.cc	2008-10-09 15:03:23 +0000
@@ -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 
 }
 
 
+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);

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2008-10-08 11:23:53 +0000
+++ b/sql/item_func.h	2008-10-09 15:03:23 +0000
@@ -1433,7 +1433,7 @@ public:
 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 @@ public:
   */
   bool is_written_to_binlog();
   bool eq(const Item *item, bool binary_cmp) const;
+
+  void cleanup();
 };
 
 

Thread
bzr commit into mysql-5.1 branch (kgeorge:2770) Bug#32124Georgi Kodinov9 Oct