summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay.choubey@sun.com>2011-01-14 19:50:34 +0530
committerNirbhay Choubey <nirbhay.choubey@sun.com>2011-01-14 19:50:34 +0530
commit95e07a6fb78d8d0f01a8bfb7064211a75ddc7edf (patch)
treeacc6315fad9570b276eedcd05fbeb423913afaec /client
parentd3ea6f9bb1dd5cb560206ef6ffbd62dac387801a (diff)
downloadmariadb-git-95e07a6fb78d8d0f01a8bfb7064211a75ddc7edf.tar.gz
Bug#13618 : mysqldump --xml omits comment on table field
When mysqldump tries to dump information in xml format, the result does not contain field level comments. In order to retrieve various informations for a field/column, mysqldump currently uses 'show fields from <tab>' statement. The attributes returned by the statement lacks the information regarding field comments. Fixed by changing the query to one that probes I_S to retrieve required field informations, including the field comment.
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index e35672c2a2c..57e3f5b0349 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2247,6 +2247,15 @@ static uint get_table_structure(char *table, char *db, char *table_type,
const char *insert_option;
char name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH];
+ const char *show_fields_stmt= "SELECT `COLUMN_NAME` AS `Field`, "
+ "`COLUMN_TYPE` AS `Type`, "
+ "`IS_NULLABLE` AS `Null`, "
+ "`COLUMN_KEY` AS `Key`, "
+ "`COLUMN_DEFAULT` AS `Default`, "
+ "`EXTRA` AS `Extra`, "
+ "`COLUMN_COMMENT` AS `Comment` "
+ "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE "
+ "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
FILE *sql_file= md_result_file;
int len;
MYSQL_RES *result;
@@ -2514,8 +2523,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
my_progname, mysql_error(mysql));
- my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
- result_table);
+ my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table);
+
if (mysql_query_with_error_report(mysql, &result, query_buff))
DBUG_RETURN(0);