List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:August 29 2011 10:53am
Subject:bzr push into mysql-trunk branch (tor.didriksen:3417)
View as plain text  
 3417 Tor Didriksen	2011-08-29 [merge]
      local merge

    modified:
      storage/innobase/dict/dict0dict.c
      storage/innobase/dict/dict0load.c
      storage/innobase/include/dict0dict.h
=== modified file 'include/decimal.h'
--- a/include/decimal.h	2011-06-30 15:46:53 +0000
+++ b/include/decimal.h	2011-08-29 09:34:48 +0000
@@ -21,6 +21,15 @@ typedef enum
   decimal_round_mode;
 typedef int32 decimal_digit_t;
 
+/**
+    intg is the number of *decimal* digits (NOT number of decimal_digit_t's !)
+         before the point
+    frac is the number of decimal digits after the point
+    len  is the length of buf (length of allocated space) in decimal_digit_t's,
+         not in bytes
+    sign false means positive, true means negative
+    buf  is an array of decimal_digit_t's
+ */
 typedef struct st_decimal_t {
   int    intg, frac, len;
   my_bool sign;

=== modified file 'mysql-test/r/type_newdecimal.result'
--- a/mysql-test/r/type_newdecimal.result	2011-05-12 04:28:33 +0000
+++ b/mysql-test/r/type_newdecimal.result	2011-08-29 10:28:51 +0000
@@ -1934,3 +1934,14 @@ f1
 0.000000000000000000000000
 DROP TABLE IF EXISTS t1;
 End of 5.1 tests
+#
+# BUG#12911710 - VALGRIND FAILURE IN 
+# ROW-DEBUG:PERFSCHEMA.SOCKET_SUMMARY_BY_INSTANCE_FUNC 
+#
+CREATE TABLE t1(d1 DECIMAL(60,0) NOT NULL,
+d2 DECIMAL(60,0) NOT NULL);
+INSERT INTO t1 (d1, d2) VALUES(0.0, 0.0);
+SELECT d1 * d2 FROM t1;
+d1 * d2
+0
+DROP TABLE t1;

=== modified file 'mysql-test/t/type_newdecimal.test'
--- a/mysql-test/t/type_newdecimal.test	2011-05-12 04:28:33 +0000
+++ b/mysql-test/t/type_newdecimal.test	2011-08-29 10:28:51 +0000
@@ -1535,3 +1535,17 @@ DROP TABLE IF EXISTS t1;
 
 
 --echo End of 5.1 tests
+
+--echo #
+--echo # BUG#12911710 - VALGRIND FAILURE IN 
+--echo # ROW-DEBUG:PERFSCHEMA.SOCKET_SUMMARY_BY_INSTANCE_FUNC 
+--echo #
+
+CREATE TABLE t1(d1 DECIMAL(60,0) NOT NULL,
+                d2 DECIMAL(60,0) NOT NULL);
+
+INSERT INTO t1 (d1, d2) VALUES(0.0, 0.0);
+SELECT d1 * d2 FROM t1;
+
+DROP TABLE t1;
+

=== modified file 'sql/my_decimal.h'
--- a/sql/my_decimal.h	2011-07-07 09:45:10 +0000
+++ b/sql/my_decimal.h	2011-08-29 10:28:51 +0000
@@ -124,12 +124,8 @@ public:
   {
     len= DECIMAL_BUFF_LENGTH;
     buf= buffer;
-#if !defined (HAVE_purify) && !defined(DBUG_OFF)
-    /* Set buffer to 'random' value to find wrong buffer usage */
-    for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++)
-      buffer[i]= i;
-#endif
   }
+
   my_decimal()
   {
     init();

=== modified file 'strings/decimal.c'
--- a/strings/decimal.c	2011-08-26 07:06:35 +0000
+++ b/strings/decimal.c	2011-08-29 10:28:51 +0000
@@ -1412,11 +1412,18 @@ int bin2decimal(const uchar *from, decim
     buf++;
   }
   my_afree(d_copy);
+
+  /*
+    No digits? We have read the number zero, of unspecified precision.
+    Make it a proper zero, with non-zero precision.
+  */
+  if (to->intg == 0 && to->frac == 0)
+    decimal_make_zero(to);
   return error;
 
 err:
   my_afree(d_copy);
-  decimal_make_zero(((decimal_t*) to));
+  decimal_make_zero(to);
   return(E_DEC_BAD_NUM);
 }
 

=== modified file 'unittest/gunit/my_decimal-t.cc'
--- a/unittest/gunit/my_decimal-t.cc	2011-07-18 08:06:21 +0000
+++ b/unittest/gunit/my_decimal-t.cc	2011-08-29 10:28:51 +0000
@@ -221,7 +221,36 @@ TEST_F(DecimalTest, Modulo)
       << " got xxx:" << buff_x
       ;
   }
+}
+
+
+TEST_F(DecimalTest, BinaryConversion)
+{
+  const int prec= 60;
+  const int scale= 0;
+  EXPECT_EQ(E_DEC_OK, chars_2_decimal("000000000", &d1));
+  int binary_size= my_decimal_get_binary_size(prec, scale);
+  uchar *bin= new uchar[binary_size];
+
+  // Convert to binary, and back.
+  EXPECT_EQ(E_DEC_OK, my_decimal2binary(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW,
+                                        &d1, bin, prec, scale));
+  EXPECT_EQ(E_DEC_OK, binary2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW,
+                                        bin, &d2, prec, scale));
+  EXPECT_GT(d2.precision(), 0U);
+  EXPECT_EQ(0, my_decimal_cmp(&d1, &d2));
 
+  // 0.0 * 0.0
+  my_decimal product;
+  EXPECT_EQ(E_DEC_OK, my_decimal_mul(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW,
+                                     &product, &d2, &d2));
+  // 0.0 * (-0.0)
+  my_decimal neg_prod;
+  my_decimal d3(d2);
+  d3.sign(true);
+  EXPECT_EQ(E_DEC_OK, my_decimal_mul(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW,
+                                     &neg_prod, &d2, &d3));
+  delete[] bin;
 }
 
 }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (tor.didriksen:3417) Tor Didriksen29 Aug