~maria-captains/maria/mysql-6.0-backup

« back to all changes in this revision

Viewing changes to sql/field.cc

  • Committer: Thava Alagu
  • Date: 2010-03-18 17:40:22 UTC
  • mfrom: (3719.14.67 mysql-6.0-codebase)
  • Revision ID: thavamuni.alagu@sun.com-20100318174022-d1yknocintpcgbp2
Auto-merge from mysql-6.0-codebase

Show diffs side-by-side

added added

removed removed

Lines of Context:
6611
6611
    local_char_length= my_charpos(field_charset, from, from+length,
6612
6612
                                  local_char_length);
6613
6613
  set_if_smaller(length, local_char_length);
6614
 
  while (length && from[length-1] == field_charset->pad_char)
6615
 
    length--;
 
6614
 
 
6615
  /*
 
6616
     TODO: change charset interface to add a new function that does 
 
6617
           the following or add a flag to lengthsp to do it itself 
 
6618
           (this is for not packing padding adding bytes in BINARY 
 
6619
           fields).
 
6620
  */
 
6621
  if (field_charset->mbmaxlen == 1)
 
6622
  {
 
6623
    while (length && from[length-1] == field_charset->pad_char)
 
6624
      length --;
 
6625
  }
 
6626
  else
 
6627
    length= field_charset->cset->lengthsp(field_charset, (const char*) from, length);
6616
6628
 
6617
6629
  // Length always stored little-endian
6618
6630
  *to++= (uchar) length;
6678
6690
 
6679
6691
  memcpy(to, from, length);
6680
6692
  // Pad the string with the pad character of the fields charset
6681
 
  bfill(to + length, field_length - length, field_charset->pad_char);
 
6693
  field_charset->cset->fill(field_charset, (char*) to + length, field_length - length, field_charset->pad_char);
6682
6694
  return from+length;
6683
6695
}
6684
6696