~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/message/statement_transform.cc

  • Committer: Stewart Smith
  • Date: 2010-07-06 05:17:49 UTC
  • mto: (1638.9.3) (1685.1.5 build)
  • mto: This revision was merged to the branch mainline in revision 1688.
  • Revision ID: stewart@flamingspork.com-20100706051749-7t3bmujyo6gymnez
make the compare_length() of index parts of VARCHAR and BLOB (i.e. those with charsets) be a length in characters instead of bytes. This makes the logic converting a table proto back into a CREATE TABLE statement remotely sane. This does mean that if we increase the number of bytes utf8_general_ci uses, engines may have issues with their on disk formats (if they're not too smart)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1033
1033
    {
1034
1034
      if (part.has_compare_length())
1035
1035
      {
1036
 
        size_t compare_length_in_chars= part.compare_length();
1037
 
        
1038
 
        /* hack: compare_length() is bytes, not chars, but
1039
 
         * only for VARCHAR. Ass. */
1040
 
        if (field.type() == Table::Field::VARCHAR)
1041
 
          compare_length_in_chars/= 4;
1042
 
 
1043
 
        if (compare_length_in_chars != field.string_options().length())
 
1036
        if (part.compare_length() != field.string_options().length())
1044
1037
        {
1045
1038
          stringstream ss;
1046
1039
          destination.push_back('(');
1047
 
          ss << compare_length_in_chars;
 
1040
          ss << part.compare_length();
1048
1041
          destination.append(ss.str());
1049
1042
          destination.push_back(')');
1050
1043
        }