From: Date: March 28 2007 9:32am Subject: bk commit into 5.0 tree (msvensson:1.2408) BUG#25197 List-Archive: http://lists.mysql.com/commits/23104 X-Bug: 25197 Message-Id: <200703280732.l2S7WqLs007270@pilot.blaudden> Below is the list of changes that have just been committed into a local 5.0 repository of msvensson. When msvensson 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@stripped, 2007-03-28 09:32:49+02:00, msvensson@stripped +3 -0 Bug#25197 repeat function returns null when using table field directly as count - Add extra test case from bug#27073 - Change "if" to be optimized for count > 0 mysql-test/r/func_str.result@stripped, 2007-03-28 09:32:47+02:00, msvensson@stripped +9 -0 Add test case from bug#27073 mysql-test/t/func_str.test@stripped, 2007-03-28 09:32:47+02:00, msvensson@stripped +4 -0 Add test case from bug#27073 sql/item_strfunc.cc@stripped, 2007-03-28 09:32:47+02:00, msvensson@stripped +1 -1 Change the if statemnet to be optimized for the normal case where count > 0 # 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: msvensson # Host: pilot.blaudden # Root: /home/msvensson/mysql/bug25197/my50-bug25197 --- 1.294/sql/item_strfunc.cc 2007-02-23 10:28:49 +01:00 +++ 1.295/sql/item_strfunc.cc 2007-03-28 09:32:47 +02:00 @@ -2252,7 +2252,7 @@ String *Item_func_repeat::val_str(String goto err; // string and/or delim are null null_value= 0; - if (count == 0 || count < 0 && !args[1]->unsigned_flag) + if (count <= 0 && (count == 0 || !args[1]->unsigned_flag)) return &my_empty_string; /* Assumes that the maximum length of a String is < INT_MAX32. */ --- 1.127/mysql-test/r/func_str.result 2007-02-23 10:28:49 +01:00 +++ 1.128/mysql-test/r/func_str.result 2007-03-28 09:32:47 +02:00 @@ -1953,5 +1953,14 @@ A B tire 0 # # 1 ## ## 2 +SELECT REPEAT('0', CAST(0 AS UNSIGNED)); +REPEAT('0', CAST(0 AS UNSIGNED)) + +SELECT REPEAT('0', -2); +REPEAT('0', -2) + +SELECT REPEAT('0', 2); +REPEAT('0', 2) +00 DROP TABLE t1; End of 5.0 tests --- 1.100/mysql-test/t/func_str.test 2007-02-23 10:28:49 +01:00 +++ 1.101/mysql-test/t/func_str.test 2007-03-28 09:32:47 +02:00 @@ -1028,6 +1028,10 @@ INSERT INTO `t1` (`id`, `tire`) VALUES ( SELECT REPEAT( '#', tire ) AS A, REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`; +SELECT REPEAT('0', CAST(0 AS UNSIGNED)); +SELECT REPEAT('0', -2); +SELECT REPEAT('0', 2); + DROP TABLE t1; --echo End of 5.0 tests