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 /sql/item_strfunc.cc | |
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 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 66308215d0b..b53172d631a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -324,7 +324,7 @@ String *Item_func_concat::val_str(String *str) } else if (str->alloced_length() >= res->length()+res2->length()) { - if (str == res2) + if (str->ptr() == res2->ptr()) str->replace(0,0,*res); else { |