mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
A clean-up patch for Item_func_conv_charset (needed for MDEV-9181)
Removing the "conv_charset" member and using collation.collation instead, as they duplicated each other.
This commit is contained in:
parent
71b39066d4
commit
77c75a46cf
3 changed files with 10 additions and 8 deletions
|
@ -3404,7 +3404,7 @@ String *Item_func_conv_charset::val_str(String *str)
|
|||
String *arg= args[0]->val_str(str);
|
||||
String_copier_for_item copier(current_thd);
|
||||
return ((null_value= args[0]->null_value ||
|
||||
copier.copy_with_warn(conv_charset, &tmp_value,
|
||||
copier.copy_with_warn(collation.collation, &tmp_value,
|
||||
arg->charset(), arg->ptr(),
|
||||
arg->length(), arg->length()))) ?
|
||||
0 : &tmp_value;
|
||||
|
@ -3412,7 +3412,7 @@ String *Item_func_conv_charset::val_str(String *str)
|
|||
|
||||
void Item_func_conv_charset::fix_length_and_dec()
|
||||
{
|
||||
collation.set(conv_charset, DERIVATION_IMPLICIT);
|
||||
DBUG_ASSERT(collation.derivation == DERIVATION_IMPLICIT);
|
||||
fix_char_length(args[0]->max_char_length());
|
||||
}
|
||||
|
||||
|
@ -3421,7 +3421,7 @@ void Item_func_conv_charset::print(String *str, enum_query_type query_type)
|
|||
str->append(STRING_WITH_LEN("convert("));
|
||||
args[0]->print(str, query_type);
|
||||
str->append(STRING_WITH_LEN(" using "));
|
||||
str->append(conv_charset->csname);
|
||||
str->append(collation.collation->csname);
|
||||
str->append(')');
|
||||
}
|
||||
|
||||
|
|
|
@ -959,20 +959,22 @@ class Item_func_conv_charset :public Item_str_func
|
|||
String tmp_value;
|
||||
public:
|
||||
bool safe;
|
||||
CHARSET_INFO *conv_charset; // keep it public
|
||||
Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs):
|
||||
Item_str_func(thd, a)
|
||||
{ conv_charset= cs; use_cached_value= 0; safe= 0; }
|
||||
{
|
||||
collation.set(cs, DERIVATION_IMPLICIT);
|
||||
use_cached_value= 0; safe= 0;
|
||||
}
|
||||
Item_func_conv_charset(THD *thd, Item *a, CHARSET_INFO *cs, bool cache_if_const):
|
||||
Item_str_func(thd, a)
|
||||
{
|
||||
conv_charset= cs;
|
||||
collation.set(cs, DERIVATION_IMPLICIT);
|
||||
if (cache_if_const && args[0]->const_item() && !args[0]->is_expensive())
|
||||
{
|
||||
uint errors= 0;
|
||||
String tmp, *str= args[0]->val_str(&tmp);
|
||||
if (!str || str_value.copy(str->ptr(), str->length(),
|
||||
str->charset(), conv_charset, &errors))
|
||||
str->charset(), cs, &errors))
|
||||
null_value= 1;
|
||||
use_cached_value= 1;
|
||||
str_value.mark_as_const();
|
||||
|
|
|
@ -4041,7 +4041,7 @@ int spider_db_mysql_util::open_item_func(
|
|||
{
|
||||
Item_func_conv_charset *item_func_conv_charset =
|
||||
(Item_func_conv_charset *)item_func;
|
||||
CHARSET_INFO *conv_charset = item_func_conv_charset->conv_charset;
|
||||
CHARSET_INFO *conv_charset = item_func_conv_charset->collation.collation;
|
||||
uint cset_length = strlen(conv_charset->csname);
|
||||
if (str->reserve(SPIDER_SQL_USING_LEN + cset_length))
|
||||
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
||||
|
|
Loading…
Reference in a new issue