mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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. client/mysqldump.c: Bug#13618 : mysqldump --xml omits comment on table field. Replaced the 'show fields' command by a statement that queries I_S, in order to retrieve information on all the attributes that 'show fields' returns along-with an additional column_comment information. mysql-test/r/client_xml.result: Result modifications for bug#13618. mysql-test/r/mysqldump.result: Result modifications for bug#13618. mysql-test/t/mysqldump.test: Added a testcase for bug#13618.
This commit is contained in:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user