List:Internals« Previous MessageNext Message »
From:gluh Date:May 10 2005 6:35pm
Subject:bk commit into 5.0 tree (gluh:1.1935)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh 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.1935 05/05/10 18:35:11 gluh@stripped +1 -0
  Merge sgluhov@stripped:/home/bk/mysql-5.0
  into mysql.com:/home/gluh/MySQL/Devel/mysql-5.0

  sql/sql_show.cc
    1.244 05/05/10 18:35:10 gluh@stripped +0 -0
    Auto merged

# 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:	gluh
# Host:	mobby.(none)
# Root:	/home/gluh/MySQL/Devel/mysql-5.0/RESYNC

--- 1.243/sql/sql_show.cc	2005-05-07 14:22:26 +00:00
+++ 1.244/sql/sql_show.cc	2005-05-10 18:35:10 +00:00
@@ -1779,32 +1779,77 @@
 
 
 /*
-  Add 'information_schema' name to db_names list
+  Create db names list. Information schema name always is first in list
 
   SYNOPSIS
-    schema_db_add()
+    make_db_list()
     thd                   thread handler
     files                 list of db names
     wild                  wild string
+    idx_field_vals        idx_field_vals->db_name contains db name or
+                          wild string
     with_i_schema         returns 1 if we added 'IS' name to list
                           otherwise returns 0
+    is_wild_value         if value is 1 then idx_field_vals->db_name is
+                          wild string otherwise it's db name; 
 
   RETURN
     1	                  error
     0	                  success
 */
 
-int schema_db_add(THD *thd, List<char> *files,
-                  const char *wild, bool *with_i_schema)
+int make_db_list(THD *thd, List<char> *files,
+                 INDEX_FIELD_VALUES *idx_field_vals,
+                 bool *with_i_schema, bool is_wild_value)
 {
+  LEX *lex= thd->lex;
   *with_i_schema= 0;
-  if (!wild || !wild_compare(information_schema_name.str, wild, 0))
+  get_index_field_values(lex, idx_field_vals);
+  if (is_wild_value)
   {
-    *with_i_schema= 1;
-    if (files->push_back(thd->strdup(information_schema_name.str)))
-      return 1;
+    /*
+      This part of code is only for SHOW DATABASES command.
+      idx_field_vals->db_value can be 0 when we don't use
+      LIKE clause (see also get_index_field_values() function)
+    */
+    if (!idx_field_vals->db_value ||
+        !wild_case_compare(system_charset_info, 
+                           information_schema_name.str,
+                           idx_field_vals->db_value))
+    {
+      *with_i_schema= 1;
+      if (files->push_back(thd->strdup(information_schema_name.str)))
+        return 1;
+    }
+    return mysql_find_files(thd, files, NullS, mysql_data_home,
+                            idx_field_vals->db_value, 1);
   }
-  return 0;
+
+  /*
+    This part of code is for SHOW TABLES, SHOW TABLE STATUS commands.
+    idx_field_vals->db_value can't be 0 (see get_index_field_values()
+    function). lex->orig_sql_command can be not equal to SQLCOM_END
+    only in case of executing of SHOW commands.
+  */
+  if (lex->orig_sql_command != SQLCOM_END)
+  {
+    if (!my_strcasecmp(system_charset_info, information_schema_name.str,
+                       idx_field_vals->db_value))
+    {
+      *with_i_schema= 1;
+      return files->push_back(thd->strdup(information_schema_name.str));
+    }
+    return files->push_back(thd->strdup(idx_field_vals->db_value));
+  }
+
+  /*
+    Create list of existing databases. It is used in case
+    of select from information schema table
+  */
+  if (files->push_back(thd->strdup(information_schema_name.str)))
+    return 1;
+  *with_i_schema= 1;
+  return mysql_find_files(thd, files, NullS, mysql_data_home, NullS, 1);
 }
 
 
@@ -1882,14 +1927,9 @@
 
   if (schema_table_idx == SCH_TABLES)
     lock_type= TL_READ;
-  get_index_field_values(lex, &idx_field_vals);
 
-  /* information schema name always is first in list */
-  if (schema_db_add(thd, &bases, idx_field_vals.db_value, &with_i_schema))
-    goto err;
-
-  if (mysql_find_files(thd, &bases, NullS, mysql_data_home,
-		       idx_field_vals.db_value, 1))
+  if (make_db_list(thd, &bases, &idx_field_vals,
+                   &with_i_schema, 0))
     goto err;
 
   partial_cond= make_cond_for_info_schema(cond, tables);
@@ -2025,13 +2065,10 @@
   TABLE *table= tables->table;
   DBUG_ENTER("fill_schema_shemata");
 
-  get_index_field_values(thd->lex, &idx_field_vals);
-  /* information schema name always is first in list */
-  if (schema_db_add(thd, &files, idx_field_vals.db_value, &with_i_schema))
-    DBUG_RETURN(1);
-  if (mysql_find_files(thd, &files, NullS, mysql_data_home,
-                       idx_field_vals.db_value, 1))
+  if (make_db_list(thd, &files, &idx_field_vals,
+                   &with_i_schema, 1))
     DBUG_RETURN(1);
+
   List_iterator_fast<char> it(files);
   while ((file_name=it++))
   {
Thread
bk commit into 5.0 tree (gluh:1.1935)gluh10 May