void Field_blob::sort_string(uchar *to,uint length)
{
  String buf;

  val_str(&buf, &buf);
  if (!buf.length() && field_charset->pad_char == 0)
    bzero(to,length);
  else
  {
    if (field_charset == &my_charset_bin)
    {
      /*
        Store length of blob last in blob to shorter blobs before longer blobs
      */
      length-= packlength;
      store_bigendian(buf.length(), to + length, packlength);
    }

#ifdef DBUG_ASSERT_EXISTS
    size_t rc=
#endif
    field_charset->coll->strnxfrm(field_charset, to, length, length,
                                  (const uchar*) buf.ptr(), buf.length(),
                                  MY_STRXFRM_PAD_WITH_SPACE |
                                  MY_STRXFRM_PAD_TO_MAXLEN);
    DBUG_ASSERT(rc == length);
  }
}
void Field_blob::sort_string(uchar *to,uint length)
{
  String buf;

  val_str(&buf, &buf);
  if (!buf.length() && field_charset->pad_char == 0)
    bzero(to,length);
  else
  {
    if (field_charset == &my_charset_bin)
    {
       
      length-= packlength;
      store_bigendian(buf.length(), to + length, packlength);
    }

#ifdef DBUG_ASSERT_EXISTS
    size_t rc=
#endif
    field_charset->coll->strnxfrm(field_charset, to, length, length,
                                  (const uchar*) buf.ptr(), buf.length(),
                                  MY_STRXFRM_PAD_WITH_SPACE |
                                  MY_STRXFRM_PAD_TO_MAXLEN);
    DBUG_ASSERT(rc == length);
  }
}