List:Commits« Previous MessageNext Message »
From:Luis Soares Date:October 20 2010 11:40am
Subject:bzr commit into mysql-trunk-bugfixing branch (luis.soares:3288)
View as plain text  
#At file:///home/lsoares/Workspace/bzr/work/bugfixing/53386/mysql-trunk-bugfixing/ based on revid:alfranio.correia@stripped

 3288 Luis Soares	2010-10-20
      Bug 53386: Work in progress.
      
      CHAR(255) CHARACTER SET UTF8 takes: 
      
        255 * field_charset->mbmaxlen (3) = 765
      
      thence uses two bytes to store the length (see 
      Field_string::pack). The table_def::calc_field_size
      considers only 1 byte always.

    modified:
      sql/rpl_utility.cc
=== modified file 'sql/rpl_utility.cc'
--- a/sql/rpl_utility.cc	2010-07-16 21:00:50 +0000
+++ b/sql/rpl_utility.cc	2010-10-20 11:40:40 +0000
@@ -225,9 +225,10 @@ uint32 table_def::calc_field_size(uint c
       /*
         We are reading the actual size from the master_data record
         because this field has the actual lengh stored in the first
-        byte.
+        one or two bytes.
       */
-      length= (uint) *master_data + 1;
+      length= (uint) m_field_metadata[col] > 255 ? 2 : 1; // c&p of Field_varstring::data_length()
+      length+= length == 1 ? (uint32) *master_data : uint2korr(master_data);
       DBUG_ASSERT(length != 0);
     }
     break;


Attachment: [text/bzr-bundle] bzr/luis.soares@oracle.com-20101020114040-n8bl87ug4n2c18sh.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (luis.soares:3288) Luis Soares20 Oct