List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:October 20 2010 12:17pm
Subject:bzr commit into mysql-5.1-telco-6.3 branch (magnus.blaudd:3312)
View as plain text  
#At file:///home/msvensson/mysql/6.3/ based on revid:jonas@stripped

 3312 Magnus Blåudd	2010-10-20
      Merge 6.2 to 6.3

    modified:
      sql/field.cc
      sql/field.h
      sql/ha_ndbcluster.cc
=== modified file 'sql/field.cc'
--- a/sql/field.cc	2010-10-12 11:54:35 +0000
+++ b/sql/field.cc	2010-10-20 12:17:32 +0000
@@ -7254,11 +7254,6 @@ uint32 Field_varstring::data_length()
   return length_bytes == 1 ? (uint32) *ptr : uint2korr(ptr);
 }
 
-uint32 Field_varstring::used_length()
-{
-  return length_bytes == 1 ? 1 + (uint32) (uchar) *ptr : 2 + uint2korr(ptr);
-}
-
 /*
   Functions to create a packed row.
   Here the number of length bytes are depending on the given max_length

=== modified file 'sql/field.h'
--- a/sql/field.h	2010-06-16 12:04:53 +0000
+++ b/sql/field.h	2010-10-20 12:17:32 +0000
@@ -185,12 +185,6 @@ public:
     For varstrings, this does _not_ include the length bytes.
   */
   virtual uint32 data_length() { return pack_length(); }
-  /*
-    used_length() returns the number of bytes actually used to store the data
-    of the field. So for a varstring it includes both lenght byte(s) and
-    string data, and anything after data_length() bytes are unused.
-  */
-  virtual uint32 used_length() { return pack_length(); }
   virtual uint32 sort_length() const { return pack_length(); }
 
   /**
@@ -1619,7 +1613,6 @@ public:
   uint packed_col_length(const uchar *to, uint length);
   uint max_packed_col_length(uint max_length);
   uint32 data_length();
-  uint32 used_length();
   uint size_of() const { return sizeof(*this); }
   enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; }
   bool has_charset(void) const

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2010-09-22 12:06:29 +0000
+++ b/sql/ha_ndbcluster.cc	2010-10-20 12:17:32 +0000
@@ -894,6 +894,24 @@ bool ha_ndbcluster::get_error_message(in
 }
 
 
+/*
+  field_used_length() returns the number of bytes actually used to
+  store the data of the field. So for a varstring it includes both
+  length byte(s) and string data, and anything after data_length()
+  bytes are unused.
+*/
+static
+uint32 field_used_length(const Field* field)
+{
+ if (field->type() == MYSQL_TYPE_VARCHAR)
+ {
+   const Field_varstring* f = static_cast<const Field_varstring*>(field);
+   return f->length_bytes + const_cast<Field_varstring*>(f)->data_length();
+                            // ^ no 'data_length() const'
+ }
+ return field->pack_length();
+}
+
 
 /**
   Check if MySQL field type forces var part in ndb storage
@@ -4579,7 +4597,7 @@ void ha_ndbcluster::unpack_record(uchar 
         if (!field->is_null())
         {
           /* Only copy actually used bytes of varstrings. */
-          uint32 actual_length= field->used_length();
+          uint32 actual_length= field_used_length(field);
           uchar *src_ptr= field->ptr;
           field->move_field_offset(dst_offset - src_offset);
           field->set_notnull();

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20101020121732-mnt30trz1dq81ngs.bundle
Thread
bzr commit into mysql-5.1-telco-6.3 branch (magnus.blaudd:3312) Magnus Blåudd20 Oct