~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.cc

  • Committer: Toru Maesaka
  • Date: 2009-02-06 14:14:48 UTC
  • mto: (840.1.15 devel)
  • mto: This revision was merged to the branch mainline in revision 852.
  • Revision ID: dev@torum.net-20090206141448-z4h0zh4zl60h8t8n
Fixed the issue of seeing an oversized separator when rendering a multibyte string to console.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2904
2904
  separator.append("+");
2905
2905
  while ((field = drizzle_fetch_field(result)))
2906
2906
  {
2907
 
    uint32_t length= column_names ? field->name_length : 0;
 
2907
    uint32_t x, length= 0;
 
2908
 
 
2909
    if (column_names)
 
2910
    {
 
2911
      /* Check if the max_byte value is really the maximum in terms
 
2912
         of visual length since multibyte characters can affect the
 
2913
         length of the separator. */
 
2914
      length= charset_info->cset->numcells(charset_info,
 
2915
                                           field->name,
 
2916
                                           field->name+field->name_length);
 
2917
 
 
2918
      if (field->name_length == field->max_length)
 
2919
        if (length < field->max_length)
 
2920
          field->max_length= length;
 
2921
      else
 
2922
        length= field->name_length;
 
2923
    }
 
2924
  
2908
2925
    if (quick)
2909
2926
      length=max(length,field->length);
2910
2927
    else
2913
2930
      // Room for "NULL"
2914
2931
      length=4;
2915
2932
    field->max_length=length;
2916
 
    uint x;
 
2933
 
2917
2934
    for (x=0; x< (length+2); x++)
2918
2935
      separator.append("-");
2919
2936
    separator.append("+");