|
|||||||||||
|
bk commit into 5.0 tree (dkatz:1.2502) BUG#29804
From: <damien(at)mysql.com>
Date: Wed Sep 05 2007 - 15:06:16 EDT
ChangeSet@1.2502, 2007-09-05 15:06:10-04:00, dkatz@damien-katzs-computer.local +5 -0 Bug #29804 UDF parameters don't contain correct string length Previously, UDF *_init functions were passed constant strings with erroneous lengths. The length came from the containing variable's size, not the length of the value itself. Now the *_init functions get the constant as a null terminated string with the correct length supplied too. mysql-test/r/udf.result@1.14, 2007-09-05 15:06:06-04:00, dkatz@damien-katzs-computer.local +24 -0 Test case to check constants passed UDFs. mysql-test/t/udf.test@1.14, 2007-09-05 15:06:06-04:00, dkatz@damien-katzs-computer.local +36 -0 Test case to check constants passed UDFs. sql/item_func.cc@1.355, 2007-09-05 15:06:06-04:00, dkatz@damien-katzs-computer.local +2 -1 UDF _init functions are now passed the length of the constants, rather than the max length of the var containing the constant. sql/udf_example.c@1.36, 2007-09-05 15:06:07-04:00, dkatz@damien-katzs-computer.local +35 -0 Added check_const_len functions. The check_const_len_init functions checks that the lengths of constants are correctly passed. sql/udf_example.def@1.4, 2007-09-05 15:06:07-04:00, dkatz@damien-katzs-computer.local +2 -0 Add new example functions to windows dll export list. diff -Nrup a/mysql-test/r/udf.result b/mysql-test/r/udf.result --- a/mysql-test/r/udf.result 2007-06-18 17:55:07 -04:00drop table t1; drop function metaphon; set GLOBAL query_cache_size=default; +CREATE TABLE const_len_bug ( +str_const varchar(4000), +result1 varchar(4000), +result2 varchar(4000) +); +CREATE TRIGGER check_const_len_trigger BEFORE INSERT ON const_len_bug FOR EACH ROW BEGIN +set NEW.str_const = 'bar'; +set NEW.result2 = check_const_len(NEW.str_const); +END | +CREATE PROCEDURE check_const_len_sp (IN str_const VARCHAR(4000)) +BEGIN +DECLARE result VARCHAR(4000); +SET result = check_const_len(str_const); +insert into const_len_bug values(str_const, result, ""); +END | +CREATE FUNCTION check_const_len RETURNS string SONAME "UDF_EXAMPLE_LIB"; +CALL check_const_len_sp("foo"); +SELECT * from const_len_bug; +str_const result1 result2 +bar Correct length Correct length +DROP FUNCTION check_const_len; +DROP PROCEDURE check_const_len_sp; +DROP TRIGGER check_const_len_trigger; +DROP TABLE const_len_bug; End of 5.0 tests. diff -Nrup a/mysql-test/t/udf.test b/mysql-test/t/udf.test --- a/mysql-test/t/udf.test 2007-06-18 17:55:07 -04:00@@ -312,4 +312,40 @@ drop function metaphon; set GLOBAL query_cache_size=default; +# --- a/sql/item_func.cc 2007-08-02 05:51:00 -04:00@@ -1106,4 +1106,39 @@ char * is_const(UDF_INIT *initid, UDF_AR } + --- a/sql/udf_example.def 2007-02-22 09:59:55 -05:00@@ -23,3 +23,5 @@ EXPORTS avgcost is_const is_const_init + check_const_len + check_const_len_init -- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Wed Sep 5 15:06:49 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:09:05 EDT |
||||||||||
|
|||||||||||