summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2004-12-10 00:17:43 +0200
committerunknown <Sinisa@sinisa.nasamreza.org>2004-12-10 00:17:43 +0200
commit41a61e84d724e48f6d1e026e7f79469b55ac230c (patch)
treeb27451f2c18a2828b5fcfbb778dd531035f336d9 /sql
parentac96a2bbcb26cdb20f9ae14d0053773c1fa4a27e (diff)
downloadmariadb-git-41a61e84d724e48f6d1e026e7f79469b55ac230c.tar.gz
A fix for a crashing bug #7101, which occures when the
expression involving LEFT() function is used in GROUP BY field. mysql-test/r/func_str.result: A result for bug #7101 test case mysql-test/t/func_str.test: Test case for bug #7101
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.cc5
-rw-r--r--sql/item_strfunc.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 893126b7fe6..7fc5e51621e 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -955,8 +955,9 @@ String *Item_func_left::val_str(String *str)
if (res->length() <= (uint) length ||
res->length() <= (char_pos= res->charpos(length)))
return res;
- str_value.set(*res, 0, char_pos);
- return &str_value;
+
+ tmp_value.set(*res, 0, char_pos);
+ return &tmp_value;
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index afe03c31345..8efe60bbd89 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -162,6 +162,7 @@ public:
class Item_func_left :public Item_str_func
{
+ String tmp_value;
public:
Item_func_left(Item *a,Item *b) :Item_str_func(a,b) {}
String *val_str(String *);