~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field_conv.cc

  • Committer: Stewart Smith
  • Date: 2010-11-08 01:14:53 UTC
  • mto: This revision was merged to the branch mainline in revision 1915.
  • Revision ID: stewart@flamingspork.com-20101108011453-79tqi2zsu7vlxnl7
in field_conv.cc, get_copy_func should not try to cast Field_blob to Field_varstring as Field_ blob does not inherit from field_varstring. Previously this kinda worked out due to the first member of field_blob kinda making sense in this comparison. Instead, we just shortcut to that decision if we are converting from BLOB.

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
        /* 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
 
691
702
        if ((dynamic_cast<Field_varstring*>(to))->pack_length_no_ptr() !=
692
703
            (dynamic_cast<Field_varstring*>(from))->pack_length_no_ptr())
693
704
        {