diff options
author | unknown <bar@mysql.com> | 2004-08-25 13:03:34 +0500 |
---|---|---|
committer | unknown <bar@mysql.com> | 2004-08-25 13:03:34 +0500 |
commit | b20d1ce4f3fb187d3c2a48479b85234c81fe85d0 (patch) | |
tree | e90b134be48810353cc2641e75e41d78b68d35dc /client | |
parent | f0fed746298db622fbd26339f8ed6aeb3fef5674 (diff) | |
download | mariadb-git-b20d1ce4f3fb187d3c2a48479b85234c81fe85d0.tar.gz |
mysql.cc:
Bug#3453: MySQL output formatting in multibyte character sets
client/mysql.cc:
Bug#3453: MySQL output formatting in multibyte character sets
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index be4c6d3df3c..dd472041b34 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2019,21 +2019,27 @@ print_table_data(MYSQL_RES *result) while ((cur= mysql_fetch_row(result))) { + ulong *lengths= mysql_fetch_lengths(result); (void) tee_fputs("|", PAGER); mysql_field_seek(result, 0); for (uint off= 0; off < mysql_num_fields(result); off++) { const char *str= cur[off] ? cur[off] : "NULL"; field= mysql_fetch_field(result); - uint length= field->max_length; - if (length > MAX_COLUMN_LENGTH) + uint maxlength= field->max_length; + if (maxlength > MAX_COLUMN_LENGTH) { tee_fputs(str, PAGER); tee_fputs(" |", PAGER); } 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); } |