summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay.choubey@sun.com>2011-02-21 12:37:24 +0530
committerNirbhay Choubey <nirbhay.choubey@sun.com>2011-02-21 12:37:24 +0530
commit876502d7439f3cf34d8554d22f28f06bf8b54388 (patch)
tree11f3ed8bb9928c0db061b1c08166002fd284f2b7 /client
parente2e6eb8f6d3dabbf335870efa29fcb77248ab156 (diff)
downloadmariadb-git-876502d7439f3cf34d8554d22f28f06bf8b54388.tar.gz
Bug#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH
("-") IN DATABASE NAMES IN ALTER DATABASE. mysqldump did not quote database name in 'ALTER DATABASE' statements in its output. This can further cause a failure while loading if database name contains a hyphen '-'. This happened as, while printing the 'ALTER DATABASE' statements, the database name was not quoted. Fixed by quoting the database name. client/mysqldump.c: Bug#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH ("-") IN DATABASE NAMES IN ALTER DATABASE. Modified the print statement in order to print the quoted database name for 'ALTER DATABASE' statements. mysql-test/r/mysqldump.result: Added a test case for bug#11766310. mysql-test/t/mysqldump.test: Added a test case for bug#11766310.
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 57e3f5b0349..0f2f1562ce5 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1134,6 +1134,9 @@ static int switch_db_collation(FILE *sql_file,
{
if (strcmp(current_db_cl_name, required_db_cl_name) != 0)
{
+ char quoted_db_buf[NAME_LEN * 2 + 3];
+ char *quoted_db_name= quote_name(db_name, quoted_db_buf, FALSE);
+
CHARSET_INFO *db_cl= get_charset_by_name(required_db_cl_name, MYF(0));
if (!db_cl)
@@ -1141,7 +1144,7 @@ static int switch_db_collation(FILE *sql_file,
fprintf(sql_file,
"ALTER DATABASE %s CHARACTER SET %s COLLATE %s %s\n",
- (const char *) db_name,
+ (const char *) quoted_db_name,
(const char *) db_cl->csname,
(const char *) db_cl->name,
(const char *) delimiter);
@@ -1162,6 +1165,9 @@ static int restore_db_collation(FILE *sql_file,
const char *delimiter,
const char *db_cl_name)
{
+ char quoted_db_buf[NAME_LEN * 2 + 3];
+ char *quoted_db_name= quote_name(db_name, quoted_db_buf, FALSE);
+
CHARSET_INFO *db_cl= get_charset_by_name(db_cl_name, MYF(0));
if (!db_cl)
@@ -1169,7 +1175,7 @@ static int restore_db_collation(FILE *sql_file,
fprintf(sql_file,
"ALTER DATABASE %s CHARACTER SET %s COLLATE %s %s\n",
- (const char *) db_name,
+ (const char *) quoted_db_name,
(const char *) db_cl->csname,
(const char *) db_cl->name,
(const char *) delimiter);