List:Commits« Previous MessageNext Message »
From:Dmitry Shulga Date:July 5 2012 5:15am
Subject:bzr push into mysql-trunk branch (Dmitry.Shulga:3901 to 3902) WL#6030
View as plain text  
 3902 Dmitry Shulga	2012-07-04
      This is a prerequisiste patch for WL#6030.
      
      This patch introduces the attribute Copy_field::from_real_maybe_null
      to check for field's nullability when copying the field.

    modified:
      sql/field.h
      sql/field_conv.cc
 3901 Dmitry Shulga	2012-07-03
      This is a prerequisite patch for WL#6030. This patch introduces
      dedicated attibute is_nullable to control the Field's nullability.

    modified:
      sql/field.cc
      sql/field.h
      sql/field_conv.cc
=== modified file 'sql/field.h'
--- a/sql/field.h	2012-07-03 10:04:33 +0000
+++ b/sql/field.h	2012-07-04 16:50:13 +0000
@@ -3847,6 +3847,7 @@ class Copy_field :public Sql_alloc {
   typedef void Copy_func(Copy_field*);
   Copy_func *get_copy_func(Field *to, Field *from);
 public:
+  bool from_real_maybe_null;
   uchar *from_ptr,*to_ptr;
   uchar *from_null_ptr,*to_null_ptr;
   my_bool *null_row;

=== modified file 'sql/field_conv.cc'
--- a/sql/field_conv.cc	2012-07-03 10:04:33 +0000
+++ b/sql/field_conv.cc	2012-07-04 16:50:13 +0000
@@ -85,7 +85,7 @@ static void do_field_8(Copy_field *copy)
 static void do_field_to_null_str(Copy_field *copy)
 {
   if (*copy->null_row ||
-      (copy->from_field->real_maybe_null() && (*copy->from_null_ptr & copy->from_bit)))
+      (copy->from_real_maybe_null && (*copy->from_null_ptr & copy->from_bit)))
   {
     memset(copy->to_ptr, 0, copy->from_length);
     copy->to_null_ptr[0]=1;			// Always bit 1
@@ -199,7 +199,7 @@ static void do_skip(Copy_field *copy __a
 static void do_copy_null(Copy_field *copy)
 {
   if (*copy->null_row ||
-      (copy->from_field->real_maybe_null() && (*copy->from_null_ptr & copy->from_bit)))
+      (copy->from_real_maybe_null && (*copy->from_null_ptr & copy->from_bit)))
   {
     *copy->to_null_ptr|=copy->to_bit;
     copy->to_field->reset();
@@ -553,9 +553,11 @@ void Copy_field::set(uchar *to,Field *fr
   to_ptr=to;
   from_length=from->pack_length();
   null_row= &from->table->null_row;
+  from_real_maybe_null= from->real_maybe_null();
   if (from->maybe_null())
   {
     from_null_ptr=from->null_ptr;
+
     from_bit=	  from->null_bit;
     to_ptr[0]=	  1;				// Null as default value
     to_null_ptr=  (uchar*) to_ptr++;
@@ -586,9 +588,9 @@ void Copy_field::set(Field *to,Field *fr
 {
   if (to->type() == MYSQL_TYPE_NULL)
   {
-    to_null_ptr=0;				// For easy debugging
-    to_ptr=0;
-    do_copy=do_skip;
+    to_null_ptr= NULL;				// For easy debugging
+    to_ptr= NULL;
+    do_copy= do_skip;
     return;
   }
   from_field=from;
@@ -597,6 +599,7 @@ void Copy_field::set(Field *to,Field *fr
   from_length=from->pack_length();
   to_ptr=  to->ptr;
   to_length=to_field->pack_length();
+  from_real_maybe_null= from->real_maybe_null();
 
   // set up null handling
   from_null_ptr=to_null_ptr=0;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (Dmitry.Shulga:3901 to 3902) WL#6030Dmitry Shulga5 Jul