From: gluh Date: October 30 2007 11:11am Subject: bk commit into 5.1 tree (gluh:1.2576) BUG#31113 List-Archive: http://lists.mysql.com/commits/36631 X-Bug: 31113 Message-Id: <20071030111143.E26BE24A0079@eagle.localdomain> Below is the list of changes that have just been committed into a local 5.1 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-10-30 15:11:39+04:00, gluh@stripped +3 -0 Bug#31113 mysqldump 5.1 can't handle a dash ("-") in database names(2nd version) db name should be quoted. this code does communication with the server. it's always ok to quote names in this case. client/mysqldump.c@stripped, 2007-10-30 15:11:37+04:00, gluh@stripped +3 -1 db name should be quoted. this code does communication with the server. it's always ok to quote names in this case. mysql-test/r/mysqldump.result@stripped, 2007-10-30 15:11:37+04:00, gluh@stripped +19 -0 test result mysql-test/t/mysqldump.test@stripped, 2007-10-30 15:11:37+04:00, gluh@stripped +12 -0 test case diff -Nrup a/client/mysqldump.c b/client/mysqldump.c --- a/client/mysqldump.c 2007-09-05 11:43:36 +05:00 +++ b/client/mysqldump.c 2007-10-30 15:11:37 +04:00 @@ -1032,8 +1032,10 @@ static int fetch_db_collation(const char char query[QUERY_LENGTH]; MYSQL_RES *db_cl_res; MYSQL_ROW db_cl_row; + char quoted_database_buf[NAME_LEN*2+3]; + char *qdatabase= quote_name(db_name, quoted_database_buf, 1); - my_snprintf(query, sizeof (query), "use %s", db_name); + my_snprintf(query, sizeof (query), "use %s", qdatabase); if (mysql_query_with_error_report(mysql, NULL, query)) return 1; diff -Nrup a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result --- a/mysql-test/r/mysqldump.result 2007-09-05 11:35:15 +05:00 +++ b/mysql-test/r/mysqldump.result 2007-10-30 15:11:37 +04:00 @@ -4190,5 +4190,24 @@ TRUNCATE mysql.event; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation # +# Bug#31113 mysqldump 5.1 can't handle a dash ("-") in database names +# +create database `test-database`; +use `test-database`; +create table test (a int); +DROP TABLE IF EXISTS `test`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `test` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; +LOCK TABLES `test` WRITE; +/*!40000 ALTER TABLE `test` DISABLE KEYS */; +/*!40000 ALTER TABLE `test` ENABLE KEYS */; +UNLOCK TABLES; +drop database `test-database`; +use test; +# # End of 5.1 tests # diff -Nrup a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test --- a/mysql-test/t/mysqldump.test 2007-09-05 11:35:13 +05:00 +++ b/mysql-test/t/mysqldump.test 2007-10-30 15:11:37 +04:00 @@ -1771,6 +1771,18 @@ TRUNCATE mysql.event; --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29938.sql SHOW EVENTS; + +--echo # +--echo # Bug#31113 mysqldump 5.1 can't handle a dash ("-") in database names +--echo # +create database `test-database`; +use `test-database`; +create table test (a int); +--exec $MYSQL_DUMP --compact --opt --quote-names test-database +drop database `test-database`; +use test; + + --echo # --echo # End of 5.1 tests --echo #