Commit 25ec2483 authored by unknown's avatar unknown

Item::str_value can't be used for storing value

(fixed error in Item_cache_str)


sql/item.cc:
  Item::str_value can't be used for storing value
sql/item.h:
  Item::str_value can't be used for storing value
parent 662506e0
...@@ -1630,11 +1630,11 @@ Item_cache* Item_cache::get_cache(Item_result type) ...@@ -1630,11 +1630,11 @@ Item_cache* Item_cache::get_cache(Item_result type)
void Item_cache_str::store(Item *item) void Item_cache_str::store(Item *item)
{ {
str_value.set(buffer, sizeof(buffer), item->charset()); value_buff.set(buffer, sizeof(buffer), item->charset());
value= item->str_result(&str_value); value= item->str_result(&value_buff);
if ((null_value= item->null_value)) if ((null_value= item->null_value))
value= 0; value= 0;
else if (value != &str_value) else if (value != &value_buff)
{ {
/* /*
We copy string value to avoid changing value if 'item' is table field We copy string value to avoid changing value if 'item' is table field
...@@ -1644,10 +1644,10 @@ void Item_cache_str::store(Item *item) ...@@ -1644,10 +1644,10 @@ void Item_cache_str::store(Item *item)
(select c from t1 where a=t2.a) (select c from t1 where a=t2.a)
from t2; from t2;
*/ */
str_value.copy(*value); value_buff.copy(*value);
value= &str_value; value= &value_buff;
} }
set_charset(&item->collation);
} }
double Item_cache_str::val() double Item_cache_str::val()
{ {
......
...@@ -920,7 +920,7 @@ class Item_cache_real: public Item_cache ...@@ -920,7 +920,7 @@ class Item_cache_real: public Item_cache
class Item_cache_str: public Item_cache class Item_cache_str: public Item_cache
{ {
char buffer[80]; char buffer[80];
String *value; String *value, value_buff;
public: public:
Item_cache_str(): Item_cache() { } Item_cache_str(): Item_cache() { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment