List:Commits« Previous MessageNext Message »
From:Alex Ivanov Notebook Date:May 15 2006 2:13pm
Subject:bk commit into 5.1 tree (aivanov:1.2395)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of alexi. When alexi 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.2395 06/05/15 16:13:33 aivanov@stripped +8 -0
  WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
   tables to INFORMATION_SCHEMA.

  sql/table.h
    1.141 06/05/15 16:13:28 aivanov@stripped +4 -0
    WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
     tables to INFORMATION_SCHEMA.

  sql/sql_show.cc
    1.335 06/05/15 16:13:28 aivanov@stripped +225 -8
    WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
     tables to INFORMATION_SCHEMA.
     Added stuff implementing the new I_S tables.
     Also, show_status_array(): argument 'ucase_names' is added (true - all
     variable names are to be converted to upper case).

  mysql-test/t/variables.test
    1.59 06/05/15 16:13:28 aivanov@stripped +42 -1
    WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
     tables to INFORMATION_SCHEMA.
     Added test cases.

  mysql-test/t/status.test
    1.16 06/05/15 16:13:27 aivanov@stripped +7 -0
    WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
     tables to INFORMATION_SCHEMA.
     Added test cases.

  mysql-test/r/variables.result
    1.84 06/05/15 16:13:27 aivanov@stripped +135 -0
    WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
     tables to INFORMATION_SCHEMA.
     Fixed results for added test cases.

  mysql-test/r/status.result
    1.11 06/05/15 16:13:27 aivanov@stripped +23 -0
    WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
     tables to INFORMATION_SCHEMA.
     Fixed results for added test cases.

  mysql-test/r/information_schema_db.result
    1.16 06/05/15 16:13:27 aivanov@stripped +4 -0
    WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
     tables to INFORMATION_SCHEMA.
     Fixed test cases results (changed because of new tables addition).

  mysql-test/r/information_schema.result
    1.119 06/05/15 16:13:27 aivanov@stripped +6 -2
    WL#3247,3248: Adding [GLOBAL|SESSION]_STATUS and [GLOBAL|SESSION]_VARIABLES
     tables to INFORMATION_SCHEMA.
     Fixed test cases results (changed because of new tables addition).

# 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:	aivanov
# Host:	mysqld.localdomain
# Root:	/home/alexi/dev/mysql-5.1-3247-48

--- 1.334/sql/sql_show.cc	2006-05-12 20:22:23 +04:00
+++ 1.335/sql/sql_show.cc	2006-05-15 16:13:28 +04:00
@@ -1873,15 +1873,22 @@
   }
 }
 
+inline void make_upper(char *buf)
+{
+  for (; *buf; buf++)
+    *buf= my_toupper(system_charset_info, *buf);
+}
+
 static bool show_status_array(THD *thd, const char *wild,
                               SHOW_VAR *variables,
                               enum enum_var_type value_type,
                               struct system_status_var *status_var,
-                              const char *prefix, TABLE *table)
+                              const char *prefix, TABLE *table,
+                              bool ucase_names)
 {
   char buff[SHOW_VAR_FUNC_BUFF_SIZE], *prefix_end;
-  /* the variable name should not be longer then 80 characters */
-  char name_buffer[80];
+  /* the variable name should not be longer then 64 characters */
+  char name_buffer[64];
   int len;
   LEX_STRING null_lex_str;
   SHOW_VAR tmp, *var;
@@ -1899,6 +1906,8 @@
   {
     strnmov(prefix_end, variables->name, len);
     name_buffer[sizeof(name_buffer)-1]=0;       /* Safety */
+    if (ucase_names)
+      make_upper(name_buffer);
 
     /*
       if var->type is SHOW_FUNC, call the function.
@@ -1910,8 +1919,8 @@
     SHOW_TYPE show_type=var->type;
     if (show_type == SHOW_ARRAY)
     {
-      show_status_array(thd, wild, (SHOW_VAR *) var->value,
-                        value_type, status_var, name_buffer, table);
+      show_status_array(thd, wild, (SHOW_VAR *) var->value, value_type,
+                        status_var, name_buffer, table, ucase_names);
     }
     else
     {
@@ -1920,7 +1929,7 @@
       {
         char *value=var->value;
         const char *pos, *end;                  // We assign a lot of const's
-        long nr;
+
         if (show_type == SHOW_SYS)
         {
           show_type= ((sys_var*) value)->type();
@@ -2002,6 +2011,7 @@
         table->field[0]->store(name_buffer, strlen(name_buffer),
                                system_charset_info);
         table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
+        table->field[1]->set_notnull();
         if (schema_table_store_record(thd, table))
           DBUG_RETURN(TRUE);
       }
@@ -4259,7 +4269,7 @@
   const char *wild= lex->wild ? lex->wild->ptr() : NullS;
   pthread_mutex_lock(&LOCK_global_system_variables);
   res= show_status_array(thd, wild, init_vars,
-                         lex->option_type, 0, "", tables->table);
+                         lex->option_type, 0, "", tables->table, 0);
   pthread_mutex_unlock(&LOCK_global_system_variables);
   DBUG_RETURN(res);
 }
@@ -4279,7 +4289,7 @@
                          (SHOW_VAR *)all_status_vars.buffer,
                          OPT_GLOBAL,
                          (lex->option_type == OPT_GLOBAL ?
-                          &tmp: &thd->status_var), "",tables->table);
+                          &tmp: &thd->status_var), "",tables->table, 0);
   pthread_mutex_unlock(&LOCK_status);
   DBUG_RETURN(res);
 }
@@ -4428,6 +4438,21 @@
         DBUG_RETURN(0);
       }
       break;
+    case MYSQL_TYPE_DECIMAL:
+      if (!(item= new Item_decimal((longlong) fields_info->value, false)))
+      {
+        DBUG_RETURN(0);
+      }
+      item->unsigned_flag= (fields_info->field_length/10000)%10;
+      item->decimals= fields_info->field_length%10;
+      item->max_length= (fields_info->field_length/100)%100;
+      if (item->unsigned_flag == 0)
+        item->max_length+= 1;
+      if (item->decimals > 0)
+        item->max_length+= 1;
+      item->set_name(fields_info->field_name,
+                     strlen(fields_info->field_name), cs);
+      break;
     default:
       /* this should be changed when Item_empty_string is fixed(in 4.1) */
       if (!(item= new Item_empty_string("", 0, cs)))
@@ -4861,6 +4886,174 @@
   DBUG_RETURN(0);
 }
 
+int fill_schema_status(THD *thd, SHOW_VAR *variables,
+                       struct system_status_var *status_var,
+                       const char *prefix, TABLE *table)
+{
+  SHOW_VAR tmp, *var;
+  SHOW_TYPE show_type;
+  LEX_STRING null_lex_str;
+  char buff[SHOW_VAR_FUNC_BUFF_SIZE];
+  char name_buf[64], *name_pos;
+  int  name_len;
+  DBUG_ENTER("fill_schema_status");
+
+  null_lex_str.str= 0;
+  null_lex_str.length= 0;
+
+  name_pos= strnmov(name_buf, prefix, sizeof(name_buf) - 1);
+  if (*prefix)
+    *name_pos++= '_';
+  name_len= name_buf + sizeof(name_buf) - name_pos;
+
+  for (; variables->name; variables++)
+  {
+    strnmov(name_pos, variables->name, name_len);
+    name_buf[sizeof(name_buf) - 1]= 0;
+    make_upper(name_buf);
+
+    for (var= variables; var->type == SHOW_FUNC; var= &tmp)
+      ((mysql_show_var_func)(var->value))(thd, &tmp, buff);
+
+    show_type= var->type;
+    
+    if (show_type == SHOW_ARRAY)
+    {
+      fill_schema_status(thd, (SHOW_VAR*) var->value,
+                         status_var, name_buf, table);
+    }
+    else
+    {
+      char *value= var->value;
+
+      restore_record(table, s->default_values);
+      table->field[0]->store(name_buf, strlen(name_buf), system_charset_info);
+
+      if (show_type == SHOW_SYS)
+      {
+        show_type= ((sys_var*) value)->type();
+        value= (char*) ((sys_var*) value)->value_ptr(thd, OPT_GLOBAL,
+                                                     &null_lex_str);
+      }
+
+      switch (show_type)
+      {
+      case SHOW_DOUBLE_STATUS:
+        value= ((char*) status_var + (ulong) value);
+        table->field[1]->store(*(double*) value);
+        break;
+      case SHOW_LONG_STATUS:
+        value= ((char*) status_var + (ulong) value);
+        /* fall through */
+      case SHOW_LONG:
+      case SHOW_LONG_NOFLUSH: // the difference lies in refresh_status()
+        table->field[1]->store((longlong) *(long*) value, false);
+        break;
+      case SHOW_LONGLONG:
+        table->field[1]->store(*(longlong*) value, false);
+        break;
+      case SHOW_HA_ROWS:
+        table->field[1]->store((longlong) *(ha_rows*) value, false);
+        break;
+      case SHOW_BOOL:
+        table->field[1]->store((longlong) *(bool*) value, false);
+        break;
+      case SHOW_MY_BOOL:
+        table->field[1]->store((longlong) *(my_bool*) value, false);
+        break;
+      case SHOW_INT:
+        table->field[1]->store((longlong) *(uint32*) value, false);
+        break;
+      case SHOW_HAVE: /* always displayed as 0 */
+        table->field[1]->store((longlong) 0, false);
+        break;
+      case SHOW_CHAR_PTR:
+        value= *(char**) value;
+        /* fall through */
+      case SHOW_CHAR: /* always displayed as 0 */
+        table->field[1]->store((longlong) 0, false);
+        break;
+      case SHOW_KEY_CACHE_LONG:
+        value= (char*) dflt_key_cache + (ulong)value;
+        table->field[1]->store((longlong) *(long*) value, false);
+        break;
+      case SHOW_KEY_CACHE_LONGLONG:
+        value= (char*) dflt_key_cache + (ulong)value;
+        table->field[1]->store(*(longlong*) value, false);
+        break;
+      case SHOW_UNDEF: /* always displayed as 0 */
+        table->field[1]->store((longlong) 0, false);
+        break;
+      case SHOW_SYS:   /* cannot happen */
+      default:
+        DBUG_ASSERT(0);
+        break;
+      }
+        
+      table->field[1]->set_notnull();
+      if (schema_table_store_record(thd, table))
+        DBUG_RETURN(1);
+    }
+  }
+
+  DBUG_RETURN(0);
+}
+
+
+int fill_schema_global_status(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  STATUS_VAR tmp;
+  int res= 0;
+  DBUG_ENTER("fill_schema_global_status");
+  
+  pthread_mutex_lock(&LOCK_status);
+  calc_sum_of_all_status(&tmp);
+  res= fill_schema_status(thd, (SHOW_VAR*) all_status_vars.buffer,
+                          &tmp, "", tables->table);
+  pthread_mutex_unlock(&LOCK_status);
+  
+  DBUG_RETURN(res);
+}
+
+int fill_schema_session_status(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  int res= 0;
+  DBUG_ENTER("fill_schema_session_status");
+  
+  pthread_mutex_lock(&LOCK_status);
+  res= fill_schema_status(thd, (SHOW_VAR*) all_status_vars.buffer,
+                          &thd->status_var, "", tables->table);
+  pthread_mutex_unlock(&LOCK_status);
+  
+  DBUG_RETURN(res);
+}
+
+int fill_schema_global_variables(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  int res= 0;
+  DBUG_ENTER("fill_schema_global_variables");
+  
+  pthread_mutex_lock(&LOCK_global_system_variables);
+  res= show_status_array(thd, "", init_vars, OPT_GLOBAL,
+                         NULL, "", tables->table, 1);
+  pthread_mutex_unlock(&LOCK_global_system_variables);
+  
+  DBUG_RETURN(res);
+}
+
+int fill_schema_session_variables(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  int res= 0;
+  DBUG_ENTER("fill_schema_session_variables");
+  
+  pthread_mutex_lock(&LOCK_global_system_variables);
+  res= show_status_array(thd, "", init_vars, OPT_SESSION,
+                         NULL, "", tables->table, 1);
+  pthread_mutex_unlock(&LOCK_global_system_variables);
+  
+  DBUG_RETURN(res);
+}
+
 ST_FIELD_INFO schema_fields_info[]=
 {
   {"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
@@ -5212,6 +5405,22 @@
 };
 
 
+ST_FIELD_INFO status_fields_info[]=
+{
+  {"VARIABLE_NAME",  64,   MYSQL_TYPE_STRING,  0, 0, "Variable_name"},
+  {"VARIABLE_VALUE", 2207, MYSQL_TYPE_DECIMAL, 0, 1, "Value"},
+  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+};
+
+
+ST_FIELD_INFO system_variables_fields_info[]=
+{
+  {"VARIABLE_NAME",  64, MYSQL_TYPE_STRING, 0, 0, "Variable_name"},
+  {"VARIABLE_VALUE", 64, MYSQL_TYPE_STRING, 0, 1, "Value"},
+  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+};
+
+
 ST_FIELD_INFO processlist_fields_info[]=
 {
   {"ID", 4, MYSQL_TYPE_LONG, 0, 0, "Id"},
@@ -5324,6 +5533,10 @@
    fill_schema_events, make_old_format, 0, -1, -1, 0},
   {"FILES", files_fields_info, create_schema_table,
    fill_schema_files, 0, 0, -1, -1, 0},
+  {"GLOBAL_STATUS", status_fields_info, create_schema_table,
+   fill_schema_global_status, make_old_format, 0, -1, -1, 0},
+  {"GLOBAL_VARIABLES", system_variables_fields_info, create_schema_table,
+   fill_schema_global_variables, make_old_format, 0, -1, -1, 0},
   {"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
     get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0},
   {"OPEN_TABLES", open_tables_fields_info, create_schema_table,
@@ -5343,6 +5556,10 @@
    fill_schema_shemata, make_schemata_old_format, 0, 1, -1, 0},
   {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
     fill_schema_schema_privileges, 0, 0, -1, -1, 0},
+  {"SESSION_STATUS", status_fields_info, create_schema_table,
+   fill_schema_session_status, make_old_format, 0, -1, -1, 0},
+  {"SESSION_VARIABLES", system_variables_fields_info, create_schema_table,
+   fill_schema_session_variables, make_old_format, 0, -1, -1, 0},
   {"STATISTICS", stat_fields_info, create_schema_table, 
     get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0},
   {"STATUS", variables_fields_info, create_schema_table, fill_status, 

--- 1.140/sql/table.h	2006-05-12 20:22:23 +04:00
+++ 1.141/sql/table.h	2006-05-15 16:13:28 +04:00
@@ -357,6 +357,8 @@
   SCH_ENGINES,
   SCH_EVENTS,
   SCH_FILES,
+  SCH_GLOBAL_STATUS,
+  SCH_GLOBAL_VARIABLES,
   SCH_KEY_COLUMN_USAGE,
   SCH_OPEN_TABLES,
   SCH_PARTITIONS,
@@ -366,6 +368,8 @@
   SCH_PROCEDURES,
   SCH_SCHEMATA,
   SCH_SCHEMA_PRIVILEGES,
+  SCH_SESSION_STATUS,
+  SCH_SESSION_VARIABLES,
   SCH_STATISTICS,
   SCH_STATUS,
   SCH_TABLES,

--- 1.118/mysql-test/r/information_schema.result	2006-05-12 10:42:00 +04:00
+++ 1.119/mysql-test/r/information_schema.result	2006-05-15 16:13:27 +04:00
@@ -46,6 +46,8 @@
 ENGINES
 EVENTS
 FILES
+GLOBAL_STATUS
+GLOBAL_VARIABLES
 KEY_COLUMN_USAGE
 PARTITIONS
 PLUGINS
@@ -54,6 +56,8 @@
 ROUTINES
 SCHEMATA
 SCHEMA_PRIVILEGES
+SESSION_STATUS
+SESSION_VARIABLES
 STATISTICS
 TABLES
 TABLE_CONSTRAINTS
@@ -746,7 +750,7 @@
 CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
 CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
 count(*)
-113
+117
 drop view a2, a1;
 drop table t_crashme;
 select table_schema,table_name, column_name from
@@ -846,7 +850,7 @@
 SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
 table_schema	count(*)
 cluster	1
-information_schema	23
+information_schema	27
 mysql	21
 create table t1 (i int, j int);
 create trigger trg1 before insert on t1 for each row

--- 1.15/mysql-test/r/information_schema_db.result	2006-05-02 15:31:32 +04:00
+++ 1.16/mysql-test/r/information_schema_db.result	2006-05-15 16:13:27 +04:00
@@ -9,6 +9,8 @@
 ENGINES
 EVENTS
 FILES
+GLOBAL_STATUS
+GLOBAL_VARIABLES
 KEY_COLUMN_USAGE
 PARTITIONS
 PLUGINS
@@ -17,6 +19,8 @@
 ROUTINES
 SCHEMATA
 SCHEMA_PRIVILEGES
+SESSION_STATUS
+SESSION_VARIABLES
 STATISTICS
 TABLES
 TABLE_CONSTRAINTS

--- 1.83/mysql-test/r/variables.result	2006-04-30 20:34:08 +04:00
+++ 1.84/mysql-test/r/variables.result	2006-05-15 16:13:27 +04:00
@@ -76,21 +76,36 @@
 show variables like 'max_join_size';
 Variable_name	Value
 max_join_size	100
+select * from information_schema.session_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	100
 show global variables like 'max_join_size';
 Variable_name	Value
 max_join_size	10
+select * from information_schema.global_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	10
 set GLOBAL max_join_size=2000;
 show global variables like 'max_join_size';
 Variable_name	Value
 max_join_size	2000
+select * from information_schema.global_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	2000
 set max_join_size=DEFAULT;
 show variables like 'max_join_size';
 Variable_name	Value
 max_join_size	2000
+select * from information_schema.session_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	2000
 set GLOBAL max_join_size=DEFAULT;
 show global variables like 'max_join_size';
 Variable_name	Value
 max_join_size	HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+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;
 @@local.max_join_size	@@global.max_join_size
@@ -122,14 +137,23 @@
 show variables like 'concurrent_insert';
 Variable_name	Value
 concurrent_insert	2
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
+VARIABLE_NAME	VARIABLE_VALUE
+CONCURRENT_INSERT	2
 set global concurrent_insert=1;
 show variables like 'concurrent_insert';
 Variable_name	Value
 concurrent_insert	1
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
+VARIABLE_NAME	VARIABLE_VALUE
+CONCURRENT_INSERT	1
 set global concurrent_insert=0;
 show variables like 'concurrent_insert';
 Variable_name	Value
 concurrent_insert	0
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
+VARIABLE_NAME	VARIABLE_VALUE
+CONCURRENT_INSERT	0
 set global concurrent_insert=DEFAULT;
 select @@concurrent_insert;
 @@concurrent_insert
@@ -138,26 +162,44 @@
 show variables like 'timed_mutexes';
 Variable_name	Value
 timed_mutexes	ON
+select * from information_schema.session_variables where variable_name like
'timed_mutexes';
+VARIABLE_NAME	VARIABLE_VALUE
+TIMED_MUTEXES	ON
 set global timed_mutexes=0;
 show variables like 'timed_mutexes';
 Variable_name	Value
 timed_mutexes	OFF
+select * from information_schema.session_variables where variable_name like
'timed_mutexes';
+VARIABLE_NAME	VARIABLE_VALUE
+TIMED_MUTEXES	OFF
 set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
 show local variables like 'storage_engine';
 Variable_name	Value
 storage_engine	MEMORY
+select * from information_schema.session_variables where variable_name like
'storage_engine';
+VARIABLE_NAME	VARIABLE_VALUE
+STORAGE_ENGINE	MEMORY
 show global variables like 'storage_engine';
 Variable_name	Value
 storage_engine	MRG_MYISAM
+select * from information_schema.global_variables where variable_name like
'storage_engine';
+VARIABLE_NAME	VARIABLE_VALUE
+STORAGE_ENGINE	MRG_MYISAM
 set GLOBAL query_cache_size=100000;
 set GLOBAL myisam_max_sort_file_size=2000000;
 show global variables like 'myisam_max_sort_file_size';
 Variable_name	Value
 myisam_max_sort_file_size	1048576
+select * from information_schema.global_variables where variable_name like
'myisam_max_sort_file_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MYISAM_MAX_SORT_FILE_SIZE	1048576
 set GLOBAL myisam_max_sort_file_size=default;
 show variables like 'myisam_max_sort_file_size';
 Variable_name	Value
 myisam_max_sort_file_size	FILE_SIZE
+select * from information_schema.session_variables where variable_name like
'myisam_max_sort_file_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MYISAM_MAX_SORT_FILE_SIZE	FILE_SIZE
 set global net_retry_count=10, session net_retry_count=10;
 set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
 set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
@@ -167,12 +209,24 @@
 net_read_timeout	300
 net_retry_count	10
 net_write_timeout	200
+select * from information_schema.global_variables where variable_name like 'net_%';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	1024
+NET_READ_TIMEOUT	300
+NET_RETRY_COUNT	10
+NET_WRITE_TIMEOUT	200
 show session variables like 'net_%';
 Variable_name	Value
 net_buffer_length	2048
 net_read_timeout	600
 net_retry_count	10
 net_write_timeout	500
+select * from information_schema.session_variables where variable_name like 'net_%';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	2048
+NET_READ_TIMEOUT	600
+NET_RETRY_COUNT	10
+NET_WRITE_TIMEOUT	500
 set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
 show global variables like 'net_%';
 Variable_name	Value
@@ -180,24 +234,45 @@
 net_read_timeout	900
 net_retry_count	10
 net_write_timeout	1000
+select * from information_schema.global_variables where variable_name like 'net_%';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	1024
+NET_READ_TIMEOUT	900
+NET_RETRY_COUNT	10
+NET_WRITE_TIMEOUT	1000
 show session variables like 'net_%';
 Variable_name	Value
 net_buffer_length	7168
 net_read_timeout	600
 net_retry_count	10
 net_write_timeout	500
+select * from information_schema.session_variables where variable_name like 'net_%';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	7168
+NET_READ_TIMEOUT	600
+NET_RETRY_COUNT	10
+NET_WRITE_TIMEOUT	500
 set net_buffer_length=1;
 show variables like 'net_buffer_length';
 Variable_name	Value
 net_buffer_length	1024
+select * from information_schema.session_variables where variable_name like
'net_buffer_length';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	1024
 set net_buffer_length=2000000000;
 show variables like 'net_buffer_length';
 Variable_name	Value
 net_buffer_length	1048576
+select * from information_schema.session_variables where variable_name like
'net_buffer_length';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	1048576
 set character set cp1251_koi8;
 show variables like "character_set_client";
 Variable_name	Value
 character_set_client	cp1251
+select * from information_schema.session_variables where variable_name like
'character_set_client';
+VARIABLE_NAME	VARIABLE_VALUE
+CHARACTER_SET_CLIENT	cp1251
 select @@timestamp>0;
 @@timestamp>0
 1
@@ -212,6 +287,13 @@
 range_alloc_block_size	2048
 transaction_alloc_block_size	8192
 transaction_prealloc_size	4096
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME	VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE	8192
+QUERY_PREALLOC_SIZE	8192
+RANGE_ALLOC_BLOCK_SIZE	2048
+TRANSACTION_ALLOC_BLOCK_SIZE	8192
+TRANSACTION_PREALLOC_SIZE	4096
 set @@range_alloc_block_size=1024*16;
 set @@query_alloc_block_size=1024*17+2;
 set @@query_prealloc_size=1024*18;
@@ -227,6 +309,13 @@
 range_alloc_block_size	16384
 transaction_alloc_block_size	19456
 transaction_prealloc_size	20480
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME	VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE	17408
+QUERY_PREALLOC_SIZE	18432
+RANGE_ALLOC_BLOCK_SIZE	16384
+TRANSACTION_ALLOC_BLOCK_SIZE	19456
+TRANSACTION_PREALLOC_SIZE	20480
 set @@range_alloc_block_size=default;
 set @@query_alloc_block_size=default, @@query_prealloc_size=default;
 set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
@@ -237,6 +326,13 @@
 range_alloc_block_size	2048
 transaction_alloc_block_size	8192
 transaction_prealloc_size	4096
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME	VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE	8192
+QUERY_PREALLOC_SIZE	8192
+RANGE_ALLOC_BLOCK_SIZE	2048
+TRANSACTION_ALLOC_BLOCK_SIZE	8192
+TRANSACTION_PREALLOC_SIZE	4096
 SELECT @@version LIKE 'non-existent';
 @@version LIKE 'non-existent'
 0
@@ -258,6 +354,9 @@
 show local variables like 'storage_engine';
 Variable_name	Value
 storage_engine	MEMORY
+select * from information_schema.session_variables where variable_name like
'storage_engine';
+VARIABLE_NAME	VARIABLE_VALUE
+STORAGE_ENGINE	MEMORY
 set SESSION query_cache_size=10000;
 ERROR HY000: Variable 'query_cache_size' is a GLOBAL variable and should be set with SET
GLOBAL
 set GLOBAL storage_engine=DEFAULT;
@@ -436,6 +535,9 @@
 show global variables like 'myisam_max_sort_file_size';
 Variable_name	Value
 myisam_max_sort_file_size	MAX_FILE_SIZE
+select * from information_schema.global_variables where variable_name like
'myisam_max_sort_file_size';
+VARIABLE_NAME	VARIABLE_VALUE
+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	@@local.max_join_size
@@ -475,18 +577,30 @@
 show global variables like 'log_warnings';
 Variable_name	Value
 log_warnings	1
+select * from information_schema.global_variables where variable_name like
'log_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_WARNINGS	1
 set global log_warnings = 0;
 show global variables like 'log_warnings';
 Variable_name	Value
 log_warnings	0
+select * from information_schema.global_variables where variable_name like
'log_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_WARNINGS	0
 set global log_warnings = 42;
 show global variables like 'log_warnings';
 Variable_name	Value
 log_warnings	42
+select * from information_schema.global_variables where variable_name like
'log_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_WARNINGS	42
 set global log_warnings = @tstlw;
 show global variables like 'log_warnings';
 Variable_name	Value
 log_warnings	1
+select * from information_schema.global_variables where variable_name like
'log_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_WARNINGS	1
 create table t1 (
 c1 tinyint,
 c2 smallint,
@@ -518,10 +632,16 @@
 SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
 Variable_name	Value
 myisam_data_pointer_size	7
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE
'MYISAM_DATA_POINTER_SIZE';
+VARIABLE_NAME	VARIABLE_VALUE
+MYISAM_DATA_POINTER_SIZE	7
 SET GLOBAL table_open_cache=-1;
 SHOW VARIABLES LIKE 'table_open_cache';
 Variable_name	Value
 table_open_cache	1
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE
'TABLE_OPEN_CACHE';
+VARIABLE_NAME	VARIABLE_VALUE
+TABLE_OPEN_CACHE	1
 SET GLOBAL table_open_cache=DEFAULT;
 set character_set_results=NULL;
 select ifnull(@@character_set_results,"really null");
@@ -590,21 +710,36 @@
 show variables like 'sql_big_selects';
 Variable_name	Value
 sql_big_selects	ON
+select * from information_schema.session_variables where variable_name like
'sql_big_selects';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_BIG_SELECTS	ON
 set @@sql_big_selects = @old_sql_big_selects;
 set @@sql_notes = 0, @@sql_warnings = 0;
 show variables like 'sql_notes';
 Variable_name	Value
 sql_notes	OFF
+select * from information_schema.session_variables where variable_name like 'sql_notes';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_NOTES	OFF
 show variables like 'sql_warnings';
 Variable_name	Value
 sql_warnings	OFF
+select * from information_schema.session_variables where variable_name like
'sql_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_WARNINGS	OFF
 set @@sql_notes = 1, @@sql_warnings = 1;
 show variables like 'sql_notes';
 Variable_name	Value
 sql_notes	ON
+select * from information_schema.session_variables where variable_name like 'sql_notes';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_NOTES	ON
 show variables like 'sql_warnings';
 Variable_name	Value
 sql_warnings	ON
+select * from information_schema.session_variables where variable_name like
'sql_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_WARNINGS	ON
 select @@system_time_zone;
 @@system_time_zone
 #

--- 1.58/mysql-test/t/variables.test	2006-04-30 20:34:08 +04:00
+++ 1.59/mysql-test/t/variables.test	2006-05-15 16:13:28 +04:00
@@ -52,16 +52,24 @@
 set GLOBAL max_join_size=10;
 set max_join_size=100;
 show variables like 'max_join_size';
+select * from information_schema.session_variables where variable_name like
'max_join_size';
 --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
 show global variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like
'max_join_size';
 set GLOBAL max_join_size=2000;
 show global variables like 'max_join_size';
+select * from information_schema.global_variables where variable_name like
'max_join_size';
 set max_join_size=DEFAULT;
 --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
 show variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.session_variables where variable_name like
'max_join_size';
 set GLOBAL max_join_size=DEFAULT;
 --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
 show global variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like
'max_join_size';
 set @@max_join_size=1000, @@global.max_join_size=2000;
 select @@local.max_join_size, @@global.max_join_size;
 select @@identity,  length(@@version)>0;
@@ -75,50 +83,68 @@
 
 set global concurrent_insert=2;
 show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
 set global concurrent_insert=1;
 show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
 set global concurrent_insert=0;
 show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
 set global concurrent_insert=DEFAULT;
 select @@concurrent_insert;
 
 set global timed_mutexes=ON;
 show variables like 'timed_mutexes';
+select * from information_schema.session_variables where variable_name like
'timed_mutexes';
 set global timed_mutexes=0;
 show variables like 'timed_mutexes';
+select * from information_schema.session_variables where variable_name like
'timed_mutexes';
 
 set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
 show local variables like 'storage_engine';
+select * from information_schema.session_variables where variable_name like
'storage_engine';
 show global variables like 'storage_engine';
+select * from information_schema.global_variables where variable_name like
'storage_engine';
 set GLOBAL query_cache_size=100000;
 
 set GLOBAL myisam_max_sort_file_size=2000000;
 show global variables like 'myisam_max_sort_file_size';
+select * from information_schema.global_variables where variable_name like
'myisam_max_sort_file_size';
 set GLOBAL myisam_max_sort_file_size=default;
 --replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
 show variables like 'myisam_max_sort_file_size';
+--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
+select * from information_schema.session_variables where variable_name like
'myisam_max_sort_file_size';
 
 set global net_retry_count=10, session net_retry_count=10;
 set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
 set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
 show global variables like 'net_%';
+select * from information_schema.global_variables where variable_name like 'net_%';
 show session variables like 'net_%';
+select * from information_schema.session_variables where variable_name like 'net_%';
 set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
 show global variables like 'net_%';
+select * from information_schema.global_variables where variable_name like 'net_%';
 show session variables like 'net_%';
+select * from information_schema.session_variables where variable_name like 'net_%';
 set net_buffer_length=1;
 show variables like 'net_buffer_length';
+select * from information_schema.session_variables where variable_name like
'net_buffer_length';
 set net_buffer_length=2000000000;
 show variables like 'net_buffer_length';
+select * from information_schema.session_variables where variable_name like
'net_buffer_length';
 
 set character set cp1251_koi8;
 show variables like "character_set_client";
+select * from information_schema.session_variables where variable_name like
'character_set_client';
 select @@timestamp>0;
 
 set @@rand_seed1=10000000,@@rand_seed2=1000000;
 select ROUND(RAND(),5);
 
 show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
 set @@range_alloc_block_size=1024*16;
 set @@query_alloc_block_size=1024*17+2;
 set @@query_prealloc_size=1024*18;
@@ -126,10 +152,12 @@
 set @@transaction_prealloc_size=1024*21-1;
 select @@query_alloc_block_size;
 show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
 set @@range_alloc_block_size=default;
 set @@query_alloc_block_size=default, @@query_prealloc_size=default;
 set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
 show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
 
 #
 # Bug #10904 Illegal mix of collations between
@@ -153,6 +181,7 @@
 --error 1231
 set storage_engine=MERGE, big_tables=2;
 show local variables like 'storage_engine';
+select * from information_schema.session_variables where variable_name like
'storage_engine';
 --error 1229
 set SESSION query_cache_size=10000;
 --error 1230
@@ -316,6 +345,8 @@
 set global myisam_max_sort_file_size=4294967296;
 --replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
 show global variables like 'myisam_max_sort_file_size';
+--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
+select * from information_schema.global_variables where variable_name like
'myisam_max_sort_file_size';
 set global myisam_max_sort_file_size=default;
 
 #
@@ -351,12 +382,16 @@
 # BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
 set @tstlw = @@log_warnings;
 show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like
'log_warnings';
 set global log_warnings = 0;
 show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like
'log_warnings';
 set global log_warnings = 42;
 show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like
'log_warnings';
 set global log_warnings = @tstlw;
 show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like
'log_warnings';
 
 #
 # BUG#4788 show create table provides incorrect statement
@@ -388,13 +423,14 @@
 
 SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
 SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
-
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE
'MYISAM_DATA_POINTER_SIZE';
 #
 # Bug #6958: negative arguments to integer options wrap around
 #
 
 SET GLOBAL table_open_cache=-1;
 SHOW VARIABLES LIKE 'table_open_cache';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE
'TABLE_OPEN_CACHE';
 SET GLOBAL table_open_cache=DEFAULT;
 
 #
@@ -480,6 +516,7 @@
 set @old_sql_big_selects = @@sql_big_selects;
 set @@sql_big_selects = 1;
 show variables like 'sql_big_selects';
+select * from information_schema.session_variables where variable_name like
'sql_big_selects';
 set @@sql_big_selects = @old_sql_big_selects;
 
 #
@@ -488,10 +525,14 @@
 # 
 set @@sql_notes = 0, @@sql_warnings = 0;
 show variables like 'sql_notes';
+select * from information_schema.session_variables where variable_name like 'sql_notes';
 show variables like 'sql_warnings';
+select * from information_schema.session_variables where variable_name like
'sql_warnings';
 set @@sql_notes = 1, @@sql_warnings = 1;
 show variables like 'sql_notes';
+select * from information_schema.session_variables where variable_name like 'sql_notes';
 show variables like 'sql_warnings';
+select * from information_schema.session_variables where variable_name like
'sql_warnings';
 
 #
 # Bug #12792: @@system_time_zone is not SELECTable.

--- 1.10/mysql-test/r/status.result	2006-04-12 17:37:50 +04:00
+++ 1.11/mysql-test/r/status.result	2006-05-15 16:13:27 +04:00
@@ -3,6 +3,10 @@
 Variable_name	Value
 Table_locks_immediate	0
 Table_locks_waited	0
+select * from information_schema.session_status where variable_name like 'Table_lock%';
+VARIABLE_NAME	VARIABLE_VALUE
+TABLE_LOCKS_IMMEDIATE	0.0000000
+TABLE_LOCKS_WAITED	0.0000000
 SET SQL_LOG_BIN=0;
 drop table if exists t1;
 create table t1(n int) engine=myisam;
@@ -16,6 +20,10 @@
 Variable_name	Value
 Table_locks_immediate	3
 Table_locks_waited	1
+select * from information_schema.session_status where variable_name like 'Table_lock%';
+VARIABLE_NAME	VARIABLE_VALUE
+TABLE_LOCKS_IMMEDIATE	3.0000000
+TABLE_LOCKS_WAITED	1.0000000
 drop table t1;
 select 1;
 1
@@ -27,19 +35,34 @@
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
 Max_used_connections	1
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_USED_CONNECTIONS	1.0000000
 SET @save_thread_cache_size=@@thread_cache_size;
 SET GLOBAL thread_cache_size=3;
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
 Max_used_connections	3
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_USED_CONNECTIONS	3.0000000
 FLUSH STATUS;
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
 Max_used_connections	2
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_USED_CONNECTIONS	2.0000000
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
 Max_used_connections	3
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_USED_CONNECTIONS	3.0000000
 SHOW STATUS LIKE 'max_used_connections';
 Variable_name	Value
 Max_used_connections	4
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_USED_CONNECTIONS	4.0000000
 SET GLOBAL thread_cache_size=@save_thread_cache_size;

--- 1.15/mysql-test/t/status.test	2006-04-12 17:37:51 +04:00
+++ 1.16/mysql-test/t/status.test	2006-05-15 16:13:27 +04:00
@@ -13,6 +13,7 @@
 
 flush status;
 show status like 'Table_lock%';
+select * from information_schema.session_status where variable_name like 'Table_lock%';
 connection con1;
 SET SQL_LOG_BIN=0;
 --disable_warnings
@@ -34,6 +35,7 @@
 connection con1;
 reap;
 show status like 'Table_lock%';
+select * from information_schema.session_status where variable_name like 'Table_lock%';
 drop table t1;
 
 disconnect con2;
@@ -89,6 +91,7 @@
 
 # Prerequisite.
 SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
 
 # Save original setting.
 SET @save_thread_cache_size=@@thread_cache_size;
@@ -102,6 +105,7 @@
 
 # Check that max_used_connections still reflects maximum value.
 SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
 
 # Check that after flush max_used_connections equals to current number
 # of connections.  First wait for previous disconnect to finish.
@@ -125,15 +129,18 @@
 --enable_result_log
 # Check that we don't count disconnected thread any longer.
 SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
 
 # Check that max_used_connections is updated when cached thread is
 # reused...
 connect (con2,localhost,root,,);
 SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
 
 # ...and when new thread is created.
 connect (con3,localhost,root,,);
 SHOW STATUS LIKE 'max_used_connections';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE
'MAX_USED_CONNECTIONS';
 
 # Restore original setting.
 connection default;
Thread
bk commit into 5.1 tree (aivanov:1.2395)Alex Ivanov Notebook15 May