Commit b20d1ce4 authored by unknown's avatar unknown

mysql.cc:

  Bug#3453: MySQL output formatting in multibyte character sets


client/mysql.cc:
  Bug#3453: MySQL output formatting in multibyte character sets
parent f0fed746
...@@ -2019,21 +2019,27 @@ print_table_data(MYSQL_RES *result) ...@@ -2019,21 +2019,27 @@ print_table_data(MYSQL_RES *result)
while ((cur= mysql_fetch_row(result))) while ((cur= mysql_fetch_row(result)))
{ {
ulong *lengths= mysql_fetch_lengths(result);
(void) tee_fputs("|", PAGER); (void) tee_fputs("|", PAGER);
mysql_field_seek(result, 0); mysql_field_seek(result, 0);
for (uint off= 0; off < mysql_num_fields(result); off++) for (uint off= 0; off < mysql_num_fields(result); off++)
{ {
const char *str= cur[off] ? cur[off] : "NULL"; const char *str= cur[off] ? cur[off] : "NULL";
field= mysql_fetch_field(result); field= mysql_fetch_field(result);
uint length= field->max_length; uint maxlength= field->max_length;
if (length > MAX_COLUMN_LENGTH) if (maxlength > MAX_COLUMN_LENGTH)
{ {
tee_fputs(str, PAGER); tee_fputs(str, PAGER);
tee_fputs(" |", PAGER); tee_fputs(" |", PAGER);
} }
else else
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|", {
length, str); uint currlength= (uint) lengths[off];
uint numcells= charset_info->cset->numcells(charset_info,
str, str + currlength);
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
maxlength + currlength - numcells, str);
}
} }
(void) tee_fputs("\n", PAGER); (void) tee_fputs("\n", PAGER);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment