summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <ram@gw.mysql.r18.ru>2004-06-08 18:01:15 +0500
committerunknown <ram@gw.mysql.r18.ru>2004-06-08 18:01:15 +0500
commit66c4087289dd05a39c6e4f5a95dad2df4ef1cfe0 (patch)
treea152aaf558cbcde196313f567fbe97ae284bdf0e /sql/item_strfunc.cc
parent5b4120288ebd7f81e198004490032be3e6ba9e79 (diff)
downloadmariadb-git-66c4087289dd05a39c6e4f5a95dad2df4ef1cfe0.tar.gz
a fix
(Bug #4035 GROUP_CONCAT with HAVING clause truncates field Bug #4057 LEFT() function in HAVING clause truncates query result). mysql-test/r/func_gconcat.result: a test case Bug #4035 GROUP_CONCAT with HAVING clause truncates field Bug #4057 LEFT() function in HAVING clause truncates query result mysql-test/t/func_gconcat.test: a test case Bug #4035 GROUP_CONCAT with HAVING clause truncates field Bug #4057 LEFT() function in HAVING clause truncates query result sql/item_strfunc.cc: a fix (Bug #4057 LEFT() function in HAVING clause truncates query result) sql/item_strfunc.h: a fix (Bug #4057 LEFT() function in HAVING clause truncates query result) sql/item_sum.cc: a fix (Bug #4035 GROUP_CONCAT with HAVING clause truncates field) sql/item_sum.h: a fix (Bug #4035 GROUP_CONCAT with HAVING clause truncates field)
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc15
1 files changed, 4 insertions, 11 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 6be9bee438e..864840b726e 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -950,17 +950,10 @@ String *Item_func_left::val_str(String *str)
return 0;
if (length <= 0)
return &my_empty_string;
- length= res->charpos(length);
- if (res->length() > (ulong) length)
- { // Safe even if const arg
- if (!res->alloced_length())
- { // Don't change const str
- str_value= *res; // Not malloced string
- res= &str_value;
- }
- res->length((uint) length);
- }
- return res;
+ if (res->length() <= (uint) length)
+ return res;
+ tmp_value.set(*res, 0, res->charpos(length));
+ return &tmp_value;
}