From: Date: May 18 2007 3:16pm Subject: bk commit into 5.0 tree (ramil:1.2484) BUG#28509 List-Archive: http://lists.mysql.com/commits/26985 X-Bug: 28509 Message-Id: <20070518131655.B480E3400079@ramil.myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.0 repository of ram. When ram 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-18 18:16:51+05:00, ramil@stripped +3 -0 Fox for bug #28509: strange behaviour: passing a decimal value to PS Set parameter's type to Item::DECIMAL_ITEM assigning a decimal value. mysql-test/r/ps.result@stripped, 2007-05-18 18:16:49+05:00, ramil@stripped +9 -0 Fox for bug #28509: strange behaviour: passing a decimal value to PS - test result. mysql-test/t/ps.test@stripped, 2007-05-18 18:16:49+05:00, ramil@stripped +8 -0 Fox for bug #28509: strange behaviour: passing a decimal value to PS - test case. sql/item.cc@stripped, 2007-05-18 18:16:49+05:00, ramil@stripped +2 -4 Fox for bug #28509: strange behaviour: passing a decimal value to PS - set Item_param::item_type to Item::DECIMAL_ITEM in case of DECIMAL_RESULT variable. - removed redundant item_result_type assignments as it's set before. # 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: ramil # Host: ramil.myoffice.izhnet.ru # Root: /home/ram/work/b28509/b28509.5.0 --- 1.266/sql/item.cc 2007-05-18 18:16:55 +05:00 +++ 1.267/sql/item.cc 2007-05-18 18:16:55 +05:00 @@ -2506,16 +2506,14 @@ bool Item_param::set_from_user_var(THD * if (entry && entry->value) { item_result_type= entry->type; - switch (entry->type) { + switch (item_result_type) { case REAL_RESULT: set_double(*(double*)entry->value); item_type= Item::REAL_ITEM; - item_result_type= REAL_RESULT; break; case INT_RESULT: set_int(*(longlong*)entry->value, MY_INT64_NUM_DECIMAL_DIGITS); item_type= Item::INT_ITEM; - item_result_type= INT_RESULT; break; case STRING_RESULT: { @@ -2537,7 +2535,6 @@ bool Item_param::set_from_user_var(THD * charset of connection, so we have to set it later. */ item_type= Item::STRING_ITEM; - item_result_type= STRING_RESULT; if (set_str((const char *)entry->value, entry->length)) DBUG_RETURN(1); @@ -2551,6 +2548,7 @@ bool Item_param::set_from_user_var(THD * decimals= ent_value->frac; max_length= my_decimal_precision_to_length(ent_value->precision(), decimals, unsigned_flag); + item_type= Item::DECIMAL_ITEM; break; } default: --- 1.89/mysql-test/r/ps.result 2007-05-18 18:16:55 +05:00 +++ 1.90/mysql-test/r/ps.result 2007-05-18 18:16:55 +05:00 @@ -1661,4 +1661,13 @@ execute stmt; ERROR 42S22: Unknown column 'y.value' in 'field list' deallocate prepare stmt; drop tables t1; +prepare stmt from "create table t1 select ?"; +set @a=1.0; +execute stmt using @a; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `?` decimal(2,1) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; End of 5.0 tests. --- 1.89/mysql-test/t/ps.test 2007-05-18 18:16:55 +05:00 +++ 1.90/mysql-test/t/ps.test 2007-05-18 18:16:55 +05:00 @@ -1773,5 +1773,13 @@ execute stmt; deallocate prepare stmt; drop tables t1; +# +# Bug #28509: strange behaviour: passing a decimal value to PS +# +prepare stmt from "create table t1 select ?"; +set @a=1.0; +execute stmt using @a; +show create table t1; +drop table t1; --echo End of 5.0 tests.