Commit bf4347eb authored by Alexander Barkov's avatar Alexander Barkov

Creating a new class in_string::Item_string_for_in_vector

and moving set_value() from Item_string to Item_string_for_in_vector,
as set_value() updates the members incompletely
(e.g. does not update max_length),
so it was dangerous to have set_value() available in Item_string.
parent c9d3b27d
......@@ -2762,6 +2762,7 @@ public:
decimals= NOT_FIXED_DEC;
fixed= 1;
}
protected:
/* Just create an item and do not fill string representation */
Item_string(CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
: m_cs_specified(FALSE)
......@@ -2772,6 +2773,7 @@ public:
decimals= NOT_FIXED_DEC;
fixed= 1;
}
public:
Item_string(const char *name_par, const char *str, uint length,
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE,
uint repertoire= MY_REPERTOIRE_UNICODE30)
......@@ -2785,11 +2787,6 @@ public:
// it is constant => can be used without fix_fields (and frequently used)
fixed= 1;
}
void set_value(const String *str)
{
str_value= *str;
collation.set(str->charset());
}
void copy_value(const char *str, uint32 length, CHARSET_INFO *fromcs,
CHARSET_INFO *tocs, uint *cnv_errors)
{
......
......@@ -883,6 +883,18 @@ class in_string :public in_vector
{
char buff[STRING_BUFFER_USUAL_SIZE];
String tmp;
class Item_string_for_in_vector: public Item_string
{
public:
Item_string_for_in_vector(CHARSET_INFO *cs):
Item_string(cs)
{ }
void set_value(const String *str)
{
str_value= *str;
collation.set(str->charset());
}
};
public:
in_string(uint elements,qsort2_cmp cmp_func, CHARSET_INFO *cs);
~in_string();
......@@ -890,12 +902,12 @@ public:
uchar *get_value(Item *item);
Item* create_item()
{
return new Item_string(collation);
return new Item_string_for_in_vector(collation);
}
void value_to_item(uint pos, Item *item)
{
String *str=((String*) base)+pos;
Item_string *to= (Item_string*)item;
Item_string_for_in_vector *to= (Item_string_for_in_vector*) item;
to->set_value(str);
}
Item_result result_type() { return STRING_RESULT; }
......
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