List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:July 25 2005 8:25pm
Subject:bk commit into 4.1 tree (jimw:1.2340) BUG#10724
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2340 05/07/25 11:25:28 jimw@stripped +7 -0
  Don't force column header to @@session.var_name if @@local.var_name
  was used. (Bug #10724)

  sql/sql_parse.cc
    1.453 05/07/25 11:25:23 jimw@stripped +10 -2
    Set the name on the Item returned by get_system_var().

  sql/item_func.cc
    1.256 05/07/25 11:25:23 jimw@stripped +2 -20
    Don't set name explicitly in get_system_var(), let it get set by the
    select_item: rule in sql_parse.yy or other callers of get_system_var().

  mysql-test/t/user_var.test
    1.21 05/07/25 11:25:23 jimw@stripped +21 -0
    Add new regression test

  mysql-test/r/variables.result
    1.61 05/07/25 11:25:23 jimw@stripped +6 -6
    Update results

  mysql-test/r/user_var.result
    1.28 05/07/25 11:25:23 jimw@stripped +24 -0
    Add new results

  mysql-test/r/ps_1general.result
    1.22 05/07/25 11:25:23 jimw@stripped +1 -1
    Updated results

  mysql-test/r/key_cache.result
    1.14 05/07/25 11:25:23 jimw@stripped +3 -3
    Updated results

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-4.1-10724

--- 1.255/sql/item_func.cc	2005-07-19 09:24:59 -07:00
+++ 1.256/sql/item_func.cc	2005-07-25 11:25:23 -07:00
@@ -3417,7 +3417,7 @@
 
   if (component.str == 0 &&
       !my_strcasecmp(system_charset_info, name.str, "VERSION"))
-    return new Item_string("@@VERSION", server_version,
+    return new Item_string(NULL, server_version,
 			   (uint) strlen(server_version),
 			   system_charset_info, DERIVATION_SYSCONST);
 
@@ -3444,28 +3444,10 @@
   }
   thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
 
-  buff[0]='@';
-  buff[1]='@';
-  pos=buff+2;
-  if (var_type == OPT_SESSION)
-    pos=strmov(pos,"session.");
-  else if (var_type == OPT_GLOBAL)
-    pos=strmov(pos,"global.");
-  
   set_if_smaller(component_name->length, MAX_SYS_VAR_LENGTH);
-  set_if_smaller(base_name->length, MAX_SYS_VAR_LENGTH);
-
-  if (component_name->str)
-  {
-    memcpy(pos, component_name->str, component_name->length);
-    pos+= component_name->length;
-    *pos++= '.';
-  }
-  memcpy(pos, base_name->str, base_name->length);
-  pos+= base_name->length;
 
   return new Item_func_get_system_var(var, var_type, component_name,
-                                      buff, pos - buff);
+                                      NULL, 0);
 }
 
 

--- 1.452/sql/sql_parse.cc	2005-07-15 10:52:19 -07:00
+++ 1.453/sql/sql_parse.cc	2005-07-25 11:25:23 -07:00
@@ -4197,6 +4197,8 @@
   THD *thd;
   LEX *lex;
   LEX_STRING tmp, null_lex_string;
+  Item *var;
+  char buff[MAX_SYS_VAR_LENGTH*2+4+8], *end;
   DBUG_ENTER("create_select_for_variable");
 
   thd= current_thd;
@@ -4206,8 +4208,14 @@
   tmp.str= (char*) var_name;
   tmp.length=strlen(var_name);
   bzero((char*) &null_lex_string.str, sizeof(null_lex_string));
-  add_item_to_list(thd, get_system_var(thd, OPT_SESSION, tmp,
-				       null_lex_string));
+  /*
+    We set the name of Item to @@session.var_name because that then is used
+    as the column name in the output.
+  */
+  var= get_system_var(thd, OPT_SESSION, tmp, null_lex_string);
+  end= strxmov(buff, "@@session.", var_name, NullS);
+  var->set_name(buff, end-buff, system_charset_info);
+  add_item_to_list(thd, var);
   DBUG_VOID_RETURN;
 }
 

--- 1.21/mysql-test/r/ps_1general.result	2005-07-12 07:35:03 -07:00
+++ 1.22/mysql-test/r/ps_1general.result	2005-07-25 11:25:23 -07:00
@@ -332,7 +332,7 @@
 ERROR 42S02: Unknown table 't5'
 prepare stmt1 from ' SELECT @@version ' ;
 execute stmt1 ;
-@@VERSION
+@@version
 <version>
 prepare stmt_do from ' do @var:=  (1 in (select a from t1)) ' ;
 prepare stmt_set from ' set @var= (1 in (select a from t1)) ' ;

--- 1.60/mysql-test/r/variables.result	2005-06-30 06:13:18 -07:00
+++ 1.61/mysql-test/r/variables.result	2005-07-25 11:25:23 -07:00
@@ -70,7 +70,7 @@
 max_join_size	HA_POS_ERROR
 set @@max_join_size=1000, @@global.max_join_size=2000;
 select @@local.max_join_size, @@global.max_join_size;
-@@session.max_join_size	@@global.max_join_size
+@@local.max_join_size	@@global.max_join_size
 1000	2000
 select @@identity,  length(@@version)>0;
 @@identity	length(@@version)>0
@@ -407,23 +407,23 @@
 myisam_max_sort_file_size	MAX_FILE_SIZE
 set global myisam_max_sort_file_size=default;
 select @@global.max_user_connections,@@local.max_join_size;
-@@global.max_user_connections	@@session.max_join_size
+@@global.max_user_connections	@@local.max_join_size
 100	200
 set @svc=@@global.max_user_connections, @svj=@@local.max_join_size;
 select @@global.max_user_connections,@@local.max_join_size;
-@@global.max_user_connections	@@session.max_join_size
+@@global.max_user_connections	@@local.max_join_size
 100	200
 set @@global.max_user_connections=111,@@local.max_join_size=222;
 select @@global.max_user_connections,@@local.max_join_size;
-@@global.max_user_connections	@@session.max_join_size
+@@global.max_user_connections	@@local.max_join_size
 111	222
 set
@@global.max_user_connections=@@local.max_join_size,@@local.max_join_size=@@global.max_user_connections;
 select @@global.max_user_connections,@@local.max_join_size;
-@@global.max_user_connections	@@session.max_join_size
+@@global.max_user_connections	@@local.max_join_size
 222	111
 set @@global.max_user_connections=@svc, @@local.max_join_size=@svj;
 select @@global.max_user_connections,@@local.max_join_size;
-@@global.max_user_connections	@@session.max_join_size
+@@global.max_user_connections	@@local.max_join_size
 100	200
 set @a=1, @b=2;
 set @a=@b, @b=@a;

--- 1.13/mysql-test/r/key_cache.result	2004-11-16 13:58:11 -08:00
+++ 1.14/mysql-test/r/key_cache.result	2005-07-25 11:25:23 -07:00
@@ -23,13 +23,13 @@
 @@global.default.key_buffer_size
 16777216
 SELECT @@global.default.`key_buffer_size`;
-@@global.default.key_buffer_size
+@@global.default.`key_buffer_size`
 16777216
 SELECT @@global.`default`.`key_buffer_size`;
-@@global.default.key_buffer_size
+@@global.`default`.`key_buffer_size`
 16777216
 SELECT @@`default`.key_buffer_size;
-@@default.key_buffer_size
+@@`default`.key_buffer_size
 16777216
 SELECT @@small.key_buffer_size;
 @@small.key_buffer_size

--- 1.27/mysql-test/r/user_var.result	2005-04-06 02:11:08 -07:00
+++ 1.28/mysql-test/r/user_var.result	2005-07-25 11:25:23 -07:00
@@ -179,3 +179,27 @@
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '@honk=99' at line 1
 set one_shot @honk=99;
 ERROR HY000: The SET ONE_SHOT syntax is reserved for purposes internal to the MySQL
server
+select @@local.max_allowed_packet;
+@@local.max_allowed_packet
+#
+select @@session.max_allowed_packet;
+@@session.max_allowed_packet
+#
+select @@global.max_allowed_packet;
+@@global.max_allowed_packet
+#
+select @@max_allowed_packet;
+@@max_allowed_packet
+#
+select @@Max_Allowed_Packet;
+@@Max_Allowed_Packet
+#
+select @@version;
+@@version
+#
+select @@global.version;
+@@global.version
+#
+select @@session.VERSION;
+@@session.VERSION
+#

--- 1.20/mysql-test/t/user_var.test	2005-04-06 02:11:08 -07:00
+++ 1.21/mysql-test/t/user_var.test	2005-07-25 11:25:23 -07:00
@@ -119,3 +119,24 @@
 set session @honk=99;
 --error 1105
 set one_shot @honk=99;
+
+#
+# Bug #10724  @@local not preserved in column name of select
+#
+# The value doesn't actually matter, we just care about the column name
+--replace_column 1 #
+select @@local.max_allowed_packet;
+--replace_column 1 #
+select @@session.max_allowed_packet;
+--replace_column 1 #
+select @@global.max_allowed_packet;
+--replace_column 1 #
+select @@max_allowed_packet;
+--replace_column 1 #
+select @@Max_Allowed_Packet;
+--replace_column 1 #
+select @@version;
+--replace_column 1 #
+select @@global.version;
+--replace_column 1 #
+select @@session.VERSION;
Thread
bk commit into 4.1 tree (jimw:1.2340) BUG#10724Jim Winstead25 Jul