MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexey Botchkov Date:April 13 2009 12:31pm
Subject:bzr commit into mysql-5.1-bugteam branch (holyfoot:2870) Bug#39737
View as plain text  
#At file:///home/hf/work/mysql_common/39737/ based on revid:chad@stripped

 2870 Alexey Botchkov	2009-04-13
      Bug#39737      Assignment operator does not allocate memory for spatial variables
         GEOMETRY fields should be handled like blobs when they're copied.
      
      per-file messages:
        mysql-test/r/gis.result
      Bug#39737      Assignment operator does not allocate memory for spatial variables
          test result
        mysql-test/t/gis.test
      Bug#39737      Assignment operator does not allocate memory for spatial variables
          test case
        sql/field_conv.cc
      Bug#39737      Assignment operator does not allocate memory for spatial variables
          to->type() == MYSQL_TYPE_GEOMETRY checks added

    modified:
      mysql-test/r/gis.result
      mysql-test/t/gis.test
      sql/field_conv.cc
=== modified file 'mysql-test/r/gis.result'
--- a/mysql-test/r/gis.result	2009-02-14 09:11:32 +0000
+++ b/mysql-test/r/gis.result	2009-04-13 12:31:28 +0000
@@ -984,4 +984,21 @@ f4	geometry	YES		NULL	
 f5	datetime	YES		NULL	
 drop view v1;
 drop table t1;
+drop procedure if exists TEST;
+CREATE PROCEDURE TEST()
+BEGIN
+DECLARE P1, P2 POINT;
+SET P1 = GeomFromText('POINT( 10 10)');
+SET P2 = P1;
+SELECT ' Both P1 and P2 should be identical:', ASTEXT(P1), ASTEXT(P2);
+SET P1 = GeomFromText('POINT( 20 20)');
+SELECT 'P1 and P2 should differ', ASTEXT(P1), ASTEXT(P2);
+END;
+|
+CALL TEST();
+Both P1 and P2 should be identical:	ASTEXT(P1)	ASTEXT(P2)
+ Both P1 and P2 should be identical:	POINT(10 10)	POINT(10 10)
+P1 and P2 should differ	ASTEXT(P1)	ASTEXT(P2)
+P1 and P2 should differ	POINT(20 20)	POINT(10 10)
+DROP PROCEDURE TEST;
 End of 5.1 tests

=== modified file 'mysql-test/t/gis.test'
--- a/mysql-test/t/gis.test	2009-02-15 09:47:04 +0000
+++ b/mysql-test/t/gis.test	2009-04-13 12:31:28 +0000
@@ -667,4 +667,26 @@ desc v1;
 drop view v1;
 drop table t1;
 
+--disable_warnings
+drop procedure if exists TEST;
+--enable_warnings
+
+DELIMITER |;
+CREATE PROCEDURE TEST()
+BEGIN
+        DECLARE P1, P2 POINT;
+
+        SET P1 = GeomFromText('POINT( 10 10)');
+        SET P2 = P1;
+        SELECT ' Both P1 and P2 should be identical:', ASTEXT(P1), ASTEXT(P2);
+
+        SET P1 = GeomFromText('POINT( 20 20)');
+
+        SELECT 'P1 and P2 should differ', ASTEXT(P1), ASTEXT(P2);
+END;
+|
+DELIMITER ;|
+CALL TEST();
+DROP PROCEDURE TEST;
+
 --echo End of 5.1 tests

=== modified file 'sql/field_conv.cc'
--- a/sql/field_conv.cc	2007-10-11 17:29:09 +0000
+++ b/sql/field_conv.cc	2009-04-13 12:31:28 +0000
@@ -756,7 +756,8 @@ Copy_field::get_copy_func(Field *to,Fiel
 int field_conv(Field *to,Field *from)
 {
   if (to->real_type() == from->real_type() &&
-      !(to->type() == MYSQL_TYPE_BLOB && to->table->copy_blobs))
+      !((to->type() == MYSQL_TYPE_BLOB || to->type() == MYSQL_TYPE_GEOMETRY)
+          && to->table->copy_blobs))
   {
     if (to->pack_length() == from->pack_length() &&
         !(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) &&
@@ -784,7 +785,7 @@ int field_conv(Field *to,Field *from)
       return 0;
     }
   }
-  if (to->type() == MYSQL_TYPE_BLOB)
+  if (to->type() == MYSQL_TYPE_BLOB || to->type() == MYSQL_TYPE_GEOMETRY)
   {						// Be sure the value is stored
     Field_blob *blob=(Field_blob*) to;
     from->val_str(&blob->value);


Attachment: [text/bzr-bundle] bzr/holyfoot@mysql.com-20090413123128-3b6ojwj7q3zkb25e.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (holyfoot:2870) Bug#39737Alexey Botchkov13 Apr