~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field_conv.cc

  • Committer: Brian Aker
  • Date: 2010-11-08 19:24:42 UTC
  • mfrom: (1267.1.8 blob-packlength)
  • Revision ID: brian@tangent.org-20101108192442-lzgg9wf818yl6oyn
Merge in Stewart's change to blob field size.

Show diffs side-by-side

added added

removed removed

Lines of Context:
688
688
        return do_field_string;
689
689
      else if (to->real_type() == DRIZZLE_TYPE_VARCHAR)
690
690
      {
691
 
        if (((Field_varstring*) to)->pack_length_no_ptr() !=
692
 
            ((Field_varstring*) from)->pack_length_no_ptr())
 
691
        /* Field_blob is not part of the Field_varstring hierarchy,
 
692
           and casting to varstring for calling pack_length_no_ptr()
 
693
           is always incorrect. Previously the below comparison has
 
694
           always evaluated to false as pack_length_no_ptr() for BLOB
 
695
           will return 4 and varstring can only be <= 2.
 
696
           If your brain slightly bleeds as to why this worked for
 
697
           so many years, you are in no way alone.
 
698
        */
 
699
        if (from->flags & BLOB_FLAG)
 
700
          return do_field_string;
 
701
 
 
702
        if ((static_cast<Field_varstring*>(to))->pack_length_no_ptr() !=
 
703
            (static_cast<Field_varstring*>(from))->pack_length_no_ptr())
693
704
        {
694
705
          return do_field_string;
695
706
        }