List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:July 5 2010 10:05am
Subject:bzr commit into mysql-trunk branch (Georgi.Kodinov:3099)
View as plain text  
#At file:///home/kgeorge/mysql/work/B53095-trunk-merge/ based on revid:li-bing.song@stripped

 3099 Georgi Kodinov	2010-07-05 [merge]
      merge

    modified:
      mysql-test/r/lowercase_view.result
      mysql-test/t/lowercase_view.test
      sql/sql_show.cc
=== modified file 'mysql-test/r/lowercase_view.result'
--- a/mysql-test/r/lowercase_view.result	2007-11-13 17:32:12 +0000
+++ b/mysql-test/r/lowercase_view.result	2010-06-25 12:59:44 +0000
@@ -148,3 +148,20 @@ a
 DROP VIEW v1;
 DROP TABLE t1;
 End of 5.0 tests.
+#
+# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
+#  returns nothing
+#
+CREATE TABLE `ttt` (
+`f1` char(3) NOT NULL,
+PRIMARY KEY (`f1`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
+'TTT';
+count(COLUMN_NAME)
+1
+SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
+count(*)
+1
+DROP TABLE `ttt`;
+End of 5.0 tests.

=== modified file 'mysql-test/t/lowercase_view.test'
--- a/mysql-test/t/lowercase_view.test	2007-11-13 09:39:52 +0000
+++ b/mysql-test/t/lowercase_view.test	2010-06-25 12:59:44 +0000
@@ -160,4 +160,26 @@ SELECT * FROM v1;
 DROP VIEW v1;
 DROP TABLE t1;
 
+
+--echo End of 5.0 tests.
+
+
+--echo #
+--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
+--echo #  returns nothing
+--echo #
+
+CREATE TABLE `ttt` (
+  `f1` char(3) NOT NULL,
+  PRIMARY KEY (`f1`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+
+SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
+'TTT';
+SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
+
+DROP TABLE `ttt`;
+
+
 --echo End of 5.0 tests.
+

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-06-25 08:08:54 +0000
+++ b/sql/sql_show.cc	2010-07-05 10:05:04 +0000
@@ -2626,36 +2626,54 @@ bool get_lookup_field_values(THD *thd, C
 {
   LEX *lex= thd->lex;
   const char *wild= lex->wild ? lex->wild->ptr() : NullS;
+  bool rc= 0;
+
   bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES));
   switch (lex->sql_command) {
   case SQLCOM_SHOW_DATABASES:
     if (wild)
     {
-      lookup_field_values->db_value.str= (char*) wild;
-      lookup_field_values->db_value.length= strlen(wild);
+      thd->make_lex_string(&lookup_field_values->db_value, 
+                           wild, strlen(wild), 0);
       lookup_field_values->wild_db_value= 1;
     }
-    return 0;
+    break;
   case SQLCOM_SHOW_TABLES:
   case SQLCOM_SHOW_TABLE_STATUS:
   case SQLCOM_SHOW_TRIGGERS:
   case SQLCOM_SHOW_EVENTS:
-    lookup_field_values->db_value.str= lex->select_lex.db;
-    lookup_field_values->db_value.length=strlen(lex->select_lex.db);
+    thd->make_lex_string(&lookup_field_values->db_value, 
+                         lex->select_lex.db, strlen(lex->select_lex.db), 0);
     if (wild)
     {
-      lookup_field_values->table_value.str= (char*)wild;
-      lookup_field_values->table_value.length= strlen(wild);
+      thd->make_lex_string(&lookup_field_values->table_value, 
+                           wild, strlen(wild), 0);
       lookup_field_values->wild_table_value= 1;
     }
-    return 0;
+    break;
   default:
     /*
       The "default" is for queries over I_S.
       All previous cases handle SHOW commands.
     */
-    return calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
+    rc= calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
+    break;
   }
+
+  if (lower_case_table_names && !rc)
+  {
+    /* 
+      We can safely do in-place upgrades here since all of the above cases
+      are allocating a new memory buffer for these strings.
+    */  
+    if (lookup_field_values->db_value.str && lookup_field_values->db_value.str[0])
+      my_casedn_str(system_charset_info, lookup_field_values->db_value.str);
+    if (lookup_field_values->table_value.str && 
+        lookup_field_values->table_value.str[0])
+      my_casedn_str(system_charset_info, lookup_field_values->table_value.str);
+  }
+
+  return rc;
 }
 
 
@@ -3441,6 +3459,7 @@ int get_all_tables(THD *thd, TABLE_LIST 
     error= 0;
     goto err;
   }
+
   DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
                              STR_OR_NIL(lookup_field_vals.db_value.str),
                              STR_OR_NIL(lookup_field_vals.table_value.str)));


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100705100504-u6muvlymmidbla7o.bundle
Thread
bzr commit into mysql-trunk branch (Georgi.Kodinov:3099) Georgi Kodinov5 Jul