From d8f3934148a1a92458fc0f206c6b0a804f30a001 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Jan 2005 14:25:40 -0800 Subject: Change 'mysql' client to output XML like the 'mysqldump' tool does, with the column names as attributes on elements, instead of trying to use the column name as the element name. Also fix some encoding issues. (Bug #7811) client/mysql.cc: Quote > and " in XML output, and use instead of , to make the output more like mysqldump --xml and avoid having to turn XXX into a sensible element name. --- client/mysql.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'client') diff --git a/client/mysql.cc b/client/mysql.cc index 635973e946c..1223a952264 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -154,6 +154,8 @@ static char mysql_charsets_dir[FN_REFLEN+1]; static const char *xmlmeta[] = { "&", "&", "<", "<", + ">", ">", + "\"", """, 0, 0 }; static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; @@ -2116,13 +2118,11 @@ print_table_data_xml(MYSQL_RES *result) (void) tee_fputs("\n \n", PAGER); for (uint i=0; i < mysql_num_fields(result); i++) { - tee_fprintf(PAGER, "\t<%s>", (fields[i].name ? - (fields[i].name[0] ? fields[i].name : - "   ") : "NULL")); + tee_fprintf(PAGER, "\t"); xmlencode_print(cur[i], lengths[i]); - tee_fprintf(PAGER, "\n", (fields[i].name ? - (fields[i].name[0] ? fields[i].name : - "   ") : "NULL")); + tee_fprintf(PAGER, "\n"); } (void) tee_fputs(" \n", PAGER); } -- cgit v1.2.1