List:Commits« Previous MessageNext Message »
From:gluh Date:December 17 2007 6:33am
Subject:bk commit into 5.0 tree (gluh:1.2583) BUG#21317
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@stripped, 2007-12-17 10:33:43+04:00, gluh@stripped +6 -0
  Bug#21317 SHOW CREATE DATABASE does not obey to lower_case_table_names
  preserve lettercase as it specified in 'show create'

  mysql-test/r/lowercase_table.result@stripped, 2007-12-17 10:33:41+04:00, gluh@stripped +5 -0
    test result

  mysql-test/t/lowercase_table.test@stripped, 2007-12-17 10:33:41+04:00, gluh@stripped +7 -0
    test case

  sql/mysql_priv.h@stripped, 2007-12-17 10:33:41+04:00, gluh@stripped +1 -1
    added 'preserve_lettercase' parameter

  sql/sql_parse.cc@stripped, 2007-12-17 10:33:41+04:00, gluh@stripped +1 -1
    preserve lettercase as it specified in 'show create'

  sql/sql_show.cc@stripped, 2007-12-17 10:33:41+04:00, gluh@stripped +6 -8
    preserve lettercase as it specified in 'show create'

  sql/table.cc@stripped, 2007-12-17 10:33:41+04:00, gluh@stripped +2 -2
    added 'preserve_lettercase' parameter

diff -Nrup a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result
--- a/mysql-test/r/lowercase_table.result	2006-10-30 14:40:09 +04:00
+++ b/mysql-test/r/lowercase_table.result	2007-12-17 10:33:41 +04:00
@@ -107,4 +107,9 @@ Tables_in_test
 ii
 drop table İİ;
 set names latin1;
+create database mysql_TEST;
+show create database mysql_TEST;
+Database	Create Database
+mysql_TEST	CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET latin1 */
+drop database mysql_TEST;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test
--- a/mysql-test/t/lowercase_table.test	2006-10-30 14:40:09 +04:00
+++ b/mysql-test/t/lowercase_table.test	2007-12-17 10:33:41 +04:00
@@ -104,4 +104,11 @@ show tables;
 drop table İİ;
 set names latin1;
 
+#
+# Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names
+#
+create database mysql_TEST;
+show create database mysql_TEST;
+drop database mysql_TEST;
+
 --echo End of 5.0 tests
diff -Nrup a/sql/mysql_priv.h b/sql/mysql_priv.h
--- a/sql/mysql_priv.h	2007-12-13 14:49:12 +04:00
+++ b/sql/mysql_priv.h	2007-12-17 10:33:41 +04:00
@@ -1576,7 +1576,7 @@ int create_frm(THD *thd, char *name, con
 	       HA_CREATE_INFO *create_info, uint keys);
 void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
 int rename_file_ext(const char * from,const char * to,const char * ext);
-bool check_db_name(char *db);
+bool check_db_name(char *db, bool preserve_lettercase= 0);
 bool check_column_name(const char *name);
 bool check_table_name(const char *name, uint length);
 char *get_field(MEM_ROOT *mem, Field *field);
diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc	2007-12-10 15:19:46 +04:00
+++ b/sql/sql_parse.cc	2007-12-17 10:33:41 +04:00
@@ -4078,7 +4078,7 @@ end_with_restore_list:
   {
     DBUG_EXECUTE_IF("4x_server_emul",
                     my_error(ER_UNKNOWN_ERROR, MYF(0)); goto error;);
-    if (!strip_sp(lex->name) || check_db_name(lex->name))
+    if (!strip_sp(lex->name) || check_db_name(lex->name, 1))
     {
       my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
       break;
diff -Nrup a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc	2007-09-20 13:54:44 +05:00
+++ b/sql/sql_show.cc	2007-12-17 10:33:41 +04:00
@@ -463,7 +463,7 @@ mysqld_show_create(THD *thd, TABLE_LIST 
 bool mysqld_show_create_db(THD *thd, char *dbname,
                            const HA_CREATE_INFO *create_info)
 {
-  char buff[2048];
+  char buff[2048], orig_db[NAME_LEN];
   String buffer(buff, sizeof(buff), system_charset_info);
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   Security_context *sctx= thd->security_ctx;
@@ -474,11 +474,9 @@ bool mysqld_show_create_db(THD *thd, cha
   Protocol *protocol=thd->protocol;
   DBUG_ENTER("mysql_show_create_db");
 
-  if (check_db_name(dbname))
-  {
-    my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
-    DBUG_RETURN(TRUE);
-  }
+  strcpy(orig_db, dbname);
+  if (lower_case_table_names && dbname != any_db)
+    my_casedn_str(files_charset_info, dbname);
 
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   if (test_all_bits(sctx->master_access, DB_ACLS))
@@ -520,12 +518,12 @@ bool mysqld_show_create_db(THD *thd, cha
     DBUG_RETURN(TRUE);
 
   protocol->prepare_for_resend();
-  protocol->store(dbname, strlen(dbname), system_charset_info);
+  protocol->store(orig_db, strlen(orig_db), system_charset_info);
   buffer.length(0);
   buffer.append(STRING_WITH_LEN("CREATE DATABASE "));
   if (create_options & HA_LEX_CREATE_IF_NOT_EXISTS)
     buffer.append(STRING_WITH_LEN("/*!32312 IF NOT EXISTS*/ "));
-  append_identifier(thd, &buffer, dbname, strlen(dbname));
+  append_identifier(thd, &buffer, orig_db, strlen(orig_db));
 
   if (create.default_table_charset)
   {
diff -Nrup a/sql/table.cc b/sql/table.cc
--- a/sql/table.cc	2007-10-10 18:26:01 +05:00
+++ b/sql/table.cc	2007-12-17 10:33:41 +04:00
@@ -1613,13 +1613,13 @@ char *get_field(MEM_ROOT *mem, Field *fi
     1   error
 */
 
-bool check_db_name(char *name)
+bool check_db_name(char *name, bool preserve_lettercase)
 {
   char *start= name;
   /* Used to catch empty names and names with end space */
   bool last_char_is_space= TRUE;
 
-  if (lower_case_table_names && name != any_db)
+  if (!preserve_lettercase && lower_case_table_names && name != any_db)
     my_casedn_str(files_charset_info, name);
 
   while (*name)
Thread
bk commit into 5.0 tree (gluh:1.2583) BUG#21317gluh17 Dec
  • Re: bk commit into 5.0 tree (gluh:1.2583) BUG#21317Sergei Golubchik19 Dec