diff options
author | unknown <grog@eucla.lemis.com> | 2006-08-02 11:26:08 +0930 |
---|---|---|
committer | unknown <grog@eucla.lemis.com> | 2006-08-02 11:26:08 +0930 |
commit | 7fd78b848a53bc18395857c933b0a41730cacb3c (patch) | |
tree | b615f4f5704b89aaf6ec86a21d069fba1acdc666 /client/mysqldump.c | |
parent | 08e6a3095e0fb0db7a02e14f8048a735c2c40c9c (diff) | |
download | mariadb-git-7fd78b848a53bc18395857c933b0a41730cacb3c.tar.gz |
BUG#13926: --order-by-primary fails if PKEY contains quote character.
Quote PKEY.
mysql-test/t/mysqldump.test:
Test for BUG#13926: --order-by-primary fails if PKEY contains quote character
mysql-test/r/mysqldump.result:
Test results for BUG#13926: --order-by-primary fails if PKEY contains quote character
client/mysqldump.c:
Fix for BUG#13926: --order-by-primary fails if PKEY contains quote character.
Quote PKEY.
Diffstat (limited to 'client/mysqldump.c')
-rw-r--r-- | client/mysqldump.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index 5b197499776..f8f95ca7fd8 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -3245,6 +3245,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); @@ -3268,8 +3270,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 */ @@ -3285,9 +3289,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]); + quoted_field= quote_name(row[4], buff, 0); + end= strmov(result, quoted_field); 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= strxmov(end, ",", quoted_field, NullS); + } } cleanup: |