Commit c0a0bc40 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 ed3b76cb
...@@ -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
{
uint currlength= (uint) lengths[off];
uint numcells= charset_info->cset->numcells(charset_info,
str, str + currlength);
tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|", tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
length, str); 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