mirror of
https://github.com/MariaDB/server.git
synced 2026-04-23 00:35:32 +02:00
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.
This commit is contained in:
parent
c9d3b27d29
commit
bf4347eba0
2 changed files with 16 additions and 7 deletions
|
|
@ -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; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue