diff options
author | Gleb Shchepa <gshchepa@mysql.com> | 2010-04-03 00:30:22 +0400 |
---|---|---|
committer | Gleb Shchepa <gshchepa@mysql.com> | 2010-04-03 00:30:22 +0400 |
commit | e2a546aef46834b8250b3129ee87e944b4dd6ccb (patch) | |
tree | d85f543365e7a75c59881e1dbc3224a190266ed2 /mysql-test/r/func_concat.result | |
parent | ab8ff15cd148a0a5855d2474db78c05ec28f20c7 (diff) | |
download | mariadb-git-e2a546aef46834b8250b3129ee87e944b4dd6ccb.tar.gz |
Bug #40625: Concat fails on DOUBLE values in a Stored
Procedure, while DECIMAL works
Selecting of the CONCAT(...<SP variable>...) result into
a user variable may return wrong data.
Item_func_concat::val_str contains a number of memory
allocation-saving tricks. One of them concatenates
strings inplace inserting the value of one string
at the beginning of the other string. However,
this trick didn't care about strings those points
to the same data buffer: this is possible when
a CONCAT() parameter is a stored procedure variable -
Item_sp_variable::val_str() uses the intermediate
Item_sp_variable::str_value field, where it may
store a reference to an external buffer.
The Item_func_concat::val_str function has been
modified to take into account val_str functions
(such as Item_sp_variable::val_str) that return
a pointer to an internal Item member variable
that may reference to a buffer provided.
mysql-test/r/func_concat.result:
Test case for the bug #40625.
mysql-test/t/func_concat.test:
Test case for the bug #40625.
sql/item_strfunc.cc:
Bug #40625: Concat fails on DOUBLE values in a Stored
Procedure, while DECIMAL works
The Item_func_concat::val_str function has been
modified to take into account val_str functions
(such as Item_sp_variable::val_str) that return
a pointer to an internal Item member variable
that may reference to a buffer provided.
Diffstat (limited to 'mysql-test/r/func_concat.result')
-rw-r--r-- | mysql-test/r/func_concat.result | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result index c4c2b46c6c2..fae8979a6e7 100644 --- a/mysql-test/r/func_concat.result +++ b/mysql-test/r/func_concat.result @@ -130,4 +130,22 @@ SELECT @query; @query abcde,0,1234 DROP PROCEDURE p1; +# +# Bug #40625: Concat fails on DOUBLE values in a Stored Procedure, +# while DECIMAL works +# +CREATE PROCEDURE p1() +BEGIN +DECLARE v1 DOUBLE(10,3); +SET v1= 100; +SET @s = CONCAT('########################################', 40 , v1); +SELECT @s; +END;// +CALL p1(); +@s +########################################40100.000 +CALL p1(); +@s +########################################40100.000 +DROP PROCEDURE p1; # End of 5.1 tests |