From: Date: May 11 2007 5:56pm Subject: bk commit into 5.0 tree (holyfoot:1.2485) List-Archive: http://lists.mysql.com/commits/26517 Message-Id: <20070511155628.3F6012C380B7@hfmain.localdomain> Below is the list of changes that have just been committed into a local 5.0 repository of hf. When hf 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-05-11 20:56:22+05:00, holyfoot@stripped +4 -0 merging fixes mysql-test/r/type_datetime.result@stripped, 2007-05-11 20:56:20+05:00, holyfoot@stripped +2 -2 result fixed mysql-test/t/type_datetime.test@stripped, 2007-05-11 20:56:20+05:00, holyfoot@stripped +1 -1 testcase fixed sql/item_func.cc@stripped, 2007-05-11 20:56:20+05:00, holyfoot@stripped +6 -3 my_decimal_length_to_precision used sql/my_decimal.h@stripped, 2007-05-11 20:56:20+05:00, holyfoot@stripped +1 -0 merging fix # 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: holyfoot # Host: hfmain.(none) # Root: /home/hf/work/27957/my50-27957 --- 1.340/sql/item_func.cc 2007-05-11 20:56:28 +05:00 +++ 1.341/sql/item_func.cc 2007-05-11 20:56:28 +05:00 @@ -1051,6 +1051,8 @@ my_decimal *Item_decimal_typecast::val_d { my_decimal tmp_buf, *tmp= args[0]->val_decimal(&tmp_buf); bool sign; + uint precision; + if ((null_value= args[0]->null_value)) return NULL; my_decimal_round(E_DEC_FATAL_ERROR, tmp, decimals, FALSE, dec); @@ -1063,9 +1065,11 @@ my_decimal *Item_decimal_typecast::val_d goto err; } } - if (max_length - 2 - decimals < (uint) my_decimal_intg(dec)) + precision= my_decimal_length_to_precision(max_length, + decimals, unsigned_flag); + if (precision - decimals < (uint) my_decimal_intg(dec)) { - max_my_decimal(dec, max_length - 2, decimals); + max_my_decimal(dec, precision, decimals); dec->sign(sign); goto err; } @@ -1084,7 +1088,6 @@ void Item_decimal_typecast::print(String { char len_buf[20*3 + 1]; char *end; - CHARSET_INFO *cs= str->charset(); uint precision= my_decimal_length_to_precision(max_length, decimals, unsigned_flag); --- 1.15/sql/my_decimal.h 2007-05-11 20:56:28 +05:00 +++ 1.16/sql/my_decimal.h 2007-05-11 20:56:28 +05:00 @@ -395,6 +395,7 @@ int my_decimal_intg(const my_decimal *a) } +inline void my_decimal_trim(ulong *precision, uint *scale) { if (!(*precision) && !(*scale)) --- 1.41/mysql-test/r/type_datetime.result 2007-05-11 20:56:28 +05:00 +++ 1.42/mysql-test/r/type_datetime.result 2007-05-11 20:56:28 +05:00 @@ -328,8 +328,8 @@ least(cast('01-01-01' as datetime), '01- select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); cast(least(cast('01-01-01' as datetime), '01-01-02') as signed) 20010101000000 -select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal); -cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal) +select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(20,2)); +cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(20,2)) 20010101000000.00 DROP PROCEDURE IF EXISTS test27759 ; CREATE PROCEDURE test27759() --- 1.27/mysql-test/t/type_datetime.test 2007-05-11 20:56:28 +05:00 +++ 1.28/mysql-test/t/type_datetime.test 2007-05-11 20:56:28 +05:00 @@ -207,7 +207,7 @@ select least(cast('01-01-01' as date), ' select greatest(cast('01-01-01' as date), '01-01-02') + 0; select least(cast('01-01-01' as datetime), '01-01-02') + 0; select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); -select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal); +select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(20,2)); --disable_warnings DROP PROCEDURE IF EXISTS test27759 ; --enable_warnings