summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-11-21 11:09:33 +0400
committerunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-11-21 11:09:33 +0400
commit248ab7c7eeede27c7750c5c309deb57c13952dde (patch)
treeed29ed08b93167cdc6c6fa2d06c3a3cd9263333b /client
parente1cc50c19e037cf26de7a06e7ab4166032ba4591 (diff)
downloadmariadb-git-248ab7c7eeede27c7750c5c309deb57c13952dde.tar.gz
BUG#13926: --order-by-primary fails if PKEY contains quote character.
Backporting from 5.0 mysql-test/r/mysqldump.result: Adding test case mysql-test/t/mysqldump.test: Adding test case
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 2d2fe439f76..3bf9fff1b86 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2589,6 +2589,8 @@ static char *primary_key_fields(const char *table_name)
char show_keys_buff[15 + 64 * 2 + 3];
uint result_length = 0;
char *result = 0;
+ char buff[NAME_LEN * 2 + 3];
+ char *quoted_field;
my_snprintf(show_keys_buff, sizeof(show_keys_buff),
"SHOW KEYS FROM %s", table_name);
@@ -2612,8 +2614,10 @@ static char *primary_key_fields(const char *table_name)
{
/* Key is unique */
do
- result_length += strlen(row[4]) + 1; /* + 1 for ',' or \0 */
- while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1);
+ {
+ quoted_field= quote_name(row[4], buff, 0);
+ result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
+ } while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
}
/* Build the ORDER BY clause result */
@@ -2627,9 +2631,13 @@ static char *primary_key_fields(const char *table_name)
}
mysql_data_seek(res, 0);
row = mysql_fetch_row(res);
- end = strmov(result, row[4]);
- while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1)
- end = strxmov(end, ",", row[4], NullS);
+ quoted_field= quote_name(row[4], buff, 0);
+ end= strmov(result, quoted_field);
+ while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1)
+ {
+ quoted_field= quote_name(row[4], buff, 0);
+ end= strxmov(end, ",", quoted_field, NullS);
+ }
}
cleanup: