List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:May 24 2006 1:44am
Subject:bk commit into 5.0 tree (cmiller:1.2142) BUG#19904
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2142 06/05/23 19:44:21 cmiller@zippy.(none) +3 -0
  Bug#19904: UDF: not initialized *is_null per row
  
  Now set is_null to false, in addition to only setting it to true when the value 
  in question is null.

  sql/udf_example.cc
    1.25 06/05/23 19:44:17 cmiller@zippy.(none) +5 -0
    Set is_null to false/zero instead of not setting it at all.

  mysql-test/t/udf.test
    1.5 06/05/23 19:44:17 cmiller@zippy.(none) +12 -0
    Add test.

  mysql-test/r/udf.result
    1.5 06/05/23 19:44:17 cmiller@zippy.(none) +18 -0
    Add result.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	cmiller
# Host:	zippy.(none)
# Root:	/home/cmiller/work/mysql/mysql-5.0__bug19904

--- 1.24/sql/udf_example.cc	2006-04-28 05:37:14 -04:00
+++ 1.25/sql/udf_example.cc	2006-05-23 19:44:17 -04:00
@@ -275,6 +275,8 @@
   {
     *is_null=1;
     return 0;
+  } else {
+    *is_null=0;
   }
   const char *w_end=word+args->lengths[0];
   char *org_result=result;
@@ -552,7 +554,10 @@
       v += args->args[i][j];
   }
   if (val)
+  {
+    *is_null=0;
     return (double) v/ (double) val;
+  }
   *is_null=1;
   return 0.0;
 }

--- 1.4/mysql-test/r/udf.result	2006-04-27 10:32:35 -04:00
+++ 1.5/mysql-test/r/udf.result	2006-05-23 19:44:17 -04:00
@@ -76,6 +76,24 @@
 metaphon(testval)
 HL
 drop procedure xxx2;
+CREATE TABLE bug19904(n INT, v varchar(10));
+INSERT INTO bug19904 VALUES (1,'one'),(2,'two'),(NULL,NULL),(3,'three'),(4,'four');
+SELECT myfunc_double(n) AS f FROM bug19904;
+f
+49.00
+50.00
+NULL
+51.00
+52.00
+SELECT metaphon(v) AS f FROM bug19904;
+f
+ON
+TW
+NULL
+0R
+FR
+DROP TABLE bug19904;
+End of 5.0 tests.
 DROP FUNCTION metaphon;
 DROP FUNCTION myfunc_double;
 DROP FUNCTION myfunc_nonexist;

--- 1.4/mysql-test/t/udf.test	2006-04-27 10:32:35 -04:00
+++ 1.5/mysql-test/t/udf.test	2006-05-23 19:44:17 -04:00
@@ -99,6 +99,17 @@
 call XXX2();
 drop procedure xxx2;
 
+#
+# Bug#19904: UDF: not initialized *is_null per row
+#
+
+CREATE TABLE bug19904(n INT, v varchar(10));
+INSERT INTO bug19904 VALUES (1,'one'),(2,'two'),(NULL,NULL),(3,'three'),(4,'four');
+SELECT myfunc_double(n) AS f FROM bug19904;
+SELECT metaphon(v) AS f FROM bug19904;
+DROP TABLE bug19904;
+
+--echo End of 5.0 tests.
 
 #
 # Drop the example functions from udf_example
@@ -113,4 +124,5 @@
 DROP FUNCTION lookup;
 DROP FUNCTION reverse_lookup;
 DROP FUNCTION avgcost;
+
 
Thread
bk commit into 5.0 tree (cmiller:1.2142) BUG#19904Chad MILLER24 May