mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Old style charset() and set_charset() were removed.
This commit is contained in:
@ -519,7 +519,7 @@ static void make_sortkey(register SORTPARAM *param,
|
|||||||
switch (sort_field->result_type) {
|
switch (sort_field->result_type) {
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
{
|
{
|
||||||
CHARSET_INFO *cs=item->charset();
|
CHARSET_INFO *cs=item->collation.collation;
|
||||||
if ((maybe_null=item->maybe_null))
|
if ((maybe_null=item->maybe_null))
|
||||||
*to++=1;
|
*to++=1;
|
||||||
/* All item->str() to use some extra byte for end null.. */
|
/* All item->str() to use some extra byte for end null.. */
|
||||||
@ -1040,7 +1040,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
|
|||||||
switch ((sortorder->result_type=sortorder->item->result_type())) {
|
switch ((sortorder->result_type=sortorder->item->result_type())) {
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
sortorder->length=sortorder->item->max_length;
|
sortorder->length=sortorder->item->max_length;
|
||||||
if (use_strnxfrm((cs=sortorder->item->charset())))
|
if (use_strnxfrm((cs=sortorder->item->collation.collation)))
|
||||||
{
|
{
|
||||||
sortorder->length= sortorder->length*cs->strxfrm_multiply;
|
sortorder->length= sortorder->length*cs->strxfrm_multiply;
|
||||||
sortorder->need_strxnfrm= 1;
|
sortorder->need_strxnfrm= 1;
|
||||||
|
23
sql/item.cc
23
sql/item.cc
@ -43,7 +43,7 @@ Item::Item():
|
|||||||
{
|
{
|
||||||
marker= 0;
|
marker= 0;
|
||||||
maybe_null=null_value=with_sum_func=unsigned_flag=0;
|
maybe_null=null_value=with_sum_func=unsigned_flag=0;
|
||||||
set_charset(default_charset(), DERIVATION_COERCIBLE);
|
collation.set(default_charset(), DERIVATION_COERCIBLE);
|
||||||
name= 0;
|
name= 0;
|
||||||
decimals= 0; max_length= 0;
|
decimals= 0; max_length= 0;
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
@ -149,7 +149,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
|
|||||||
{
|
{
|
||||||
if (binary_cmp)
|
if (binary_cmp)
|
||||||
return !sortcmp(&str_value, &item->str_value, &my_charset_bin);
|
return !sortcmp(&str_value, &item->str_value, &my_charset_bin);
|
||||||
return !sortcmp(&str_value, &item->str_value, charset());
|
return !sortcmp(&str_value, &item->str_value, collation.collation);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ bool DTCollation::aggregate(DTCollation &dt)
|
|||||||
Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
|
Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
|
||||||
{
|
{
|
||||||
set_field(f);
|
set_field(f);
|
||||||
set_charset(DERIVATION_IMPLICIT);
|
collation.set(DERIVATION_IMPLICIT);
|
||||||
fixed= 1; // This item is not needed in fix_fields
|
fixed= 1; // This item is not needed in fix_fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ Item_field::Item_field(THD *thd, Item_field &item):
|
|||||||
Item_ident(thd, item),
|
Item_ident(thd, item),
|
||||||
field(item.field),
|
field(item.field),
|
||||||
result_field(item.result_field)
|
result_field(item.result_field)
|
||||||
{ set_charset(DERIVATION_IMPLICIT); }
|
{ collation.set(DERIVATION_IMPLICIT); }
|
||||||
|
|
||||||
void Item_field::set_field(Field *field_par)
|
void Item_field::set_field(Field *field_par)
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ void Item_field::set_field(Field *field_par)
|
|||||||
field_name=field_par->field_name;
|
field_name=field_par->field_name;
|
||||||
db_name=field_par->table->table_cache_key;
|
db_name=field_par->table->table_cache_key;
|
||||||
unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
|
unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
|
||||||
set_charset(field_par->charset(), DERIVATION_IMPLICIT);
|
collation.set(field_par->charset(), DERIVATION_IMPLICIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Item_ident::full_name() const
|
const char *Item_ident::full_name() const
|
||||||
@ -962,7 +962,7 @@ void Item::init_make_field(Send_field *tmp_field,
|
|||||||
tmp_field->org_col_name= empty_name;
|
tmp_field->org_col_name= empty_name;
|
||||||
tmp_field->table_name= empty_name;
|
tmp_field->table_name= empty_name;
|
||||||
tmp_field->col_name= name;
|
tmp_field->col_name= name;
|
||||||
tmp_field->charsetnr= charset()->number;
|
tmp_field->charsetnr= collation.collation->number;
|
||||||
tmp_field->flags=maybe_null ? 0 : NOT_NULL_FLAG;
|
tmp_field->flags=maybe_null ? 0 : NOT_NULL_FLAG;
|
||||||
tmp_field->type=field_type;
|
tmp_field->type=field_type;
|
||||||
tmp_field->length=max_length;
|
tmp_field->length=max_length;
|
||||||
@ -1076,7 +1076,7 @@ int Item::save_in_field(Field *field, bool no_conversions)
|
|||||||
field->result_type() == STRING_RESULT)
|
field->result_type() == STRING_RESULT)
|
||||||
{
|
{
|
||||||
String *result;
|
String *result;
|
||||||
CHARSET_INFO *cs=charset();
|
CHARSET_INFO *cs= collation.collation;
|
||||||
char buff[MAX_FIELD_WIDTH]; // Alloc buffer for small columns
|
char buff[MAX_FIELD_WIDTH]; // Alloc buffer for small columns
|
||||||
str_value.set_quick(buff,sizeof(buff),cs);
|
str_value.set_quick(buff,sizeof(buff),cs);
|
||||||
result=val_str(&str_value);
|
result=val_str(&str_value);
|
||||||
@ -1113,7 +1113,8 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
|
|||||||
if (null_value)
|
if (null_value)
|
||||||
return set_field_to_null(field);
|
return set_field_to_null(field);
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
return (field->store(result->ptr(),result->length(),charset())) ? -1 : 0;
|
return (field->store(result->ptr(),result->length(),collation.collation)) ?
|
||||||
|
-1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1167,7 +1168,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length)
|
|||||||
str+=2;
|
str+=2;
|
||||||
}
|
}
|
||||||
*ptr=0; // Keep purify happy
|
*ptr=0; // Keep purify happy
|
||||||
set_charset(&my_charset_bin, DERIVATION_COERCIBLE);
|
collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
longlong Item_varbinary::val_int()
|
longlong Item_varbinary::val_int()
|
||||||
@ -1188,7 +1189,7 @@ int Item_varbinary::save_in_field(Field *field, bool no_conversions)
|
|||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
if (field->result_type() == STRING_RESULT)
|
if (field->result_type() == STRING_RESULT)
|
||||||
{
|
{
|
||||||
error=field->store(str_value.ptr(),str_value.length(),charset());
|
error=field->store(str_value.ptr(),str_value.length(),collation.collation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1686,7 +1687,7 @@ 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());
|
str_value.set(buffer, sizeof(buffer), item->collation.collation);
|
||||||
value= item->str_result(&str_value);
|
value= item->str_result(&str_value);
|
||||||
if ((null_value= item->null_value))
|
if ((null_value= item->null_value))
|
||||||
value= 0;
|
value= 0;
|
||||||
|
21
sql/item.h
21
sql/item.h
@ -169,21 +169,6 @@ public:
|
|||||||
virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); }
|
virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); }
|
||||||
|
|
||||||
CHARSET_INFO *default_charset() const;
|
CHARSET_INFO *default_charset() const;
|
||||||
Derivation derivation() const { return collation.derivation; }
|
|
||||||
CHARSET_INFO *charset() const { return collation.collation; }
|
|
||||||
void set_charset(CHARSET_INFO *cs)
|
|
||||||
{ collation.collation= cs; }
|
|
||||||
void set_charset(Derivation dv)
|
|
||||||
{ collation.derivation= dv; }
|
|
||||||
void set_charset(CHARSET_INFO *cs, Derivation dv)
|
|
||||||
{ collation.collation= cs; collation.derivation= dv; }
|
|
||||||
void set_charset(Item &item)
|
|
||||||
{ collation= item.collation; }
|
|
||||||
void set_charset(DTCollation *collation_arg)
|
|
||||||
{
|
|
||||||
collation.collation= collation_arg->collation;
|
|
||||||
collation.derivation= collation_arg->derivation;
|
|
||||||
}
|
|
||||||
virtual void set_outer_resolving() {}
|
virtual void set_outer_resolving() {}
|
||||||
|
|
||||||
// Row emulation
|
// Row emulation
|
||||||
@ -229,7 +214,7 @@ public:
|
|||||||
Item_field(const char *db_par,const char *table_name_par,
|
Item_field(const char *db_par,const char *table_name_par,
|
||||||
const char *field_name_par)
|
const char *field_name_par)
|
||||||
:Item_ident(db_par,table_name_par,field_name_par),field(0),result_field(0)
|
:Item_ident(db_par,table_name_par,field_name_par),field(0),result_field(0)
|
||||||
{ set_charset(DERIVATION_IMPLICIT); }
|
{ collation.set(DERIVATION_IMPLICIT); }
|
||||||
// Constructor need to process subselect with temporary tables (see Item)
|
// Constructor need to process subselect with temporary tables (see Item)
|
||||||
Item_field(THD *thd, Item_field &item);
|
Item_field(THD *thd, Item_field &item);
|
||||||
Item_field(Field *field);
|
Item_field(Field *field);
|
||||||
@ -432,7 +417,7 @@ public:
|
|||||||
Item_string(const char *str,uint length,
|
Item_string(const char *str,uint length,
|
||||||
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
|
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
|
||||||
{
|
{
|
||||||
set_charset(cs, dv);
|
collation.set(cs, dv);
|
||||||
str_value.set(str,length,cs);
|
str_value.set(str,length,cs);
|
||||||
max_length=length;
|
max_length=length;
|
||||||
set_name(str, length, cs);
|
set_name(str, length, cs);
|
||||||
@ -441,7 +426,7 @@ public:
|
|||||||
Item_string(const char *name_par, const char *str, uint length,
|
Item_string(const char *name_par, const char *str, uint length,
|
||||||
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
|
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
|
||||||
{
|
{
|
||||||
set_charset(cs, dv);
|
collation.set(cs, dv);
|
||||||
str_value.set(str,length,cs);
|
str_value.set(str,length,cs);
|
||||||
max_length=length;
|
max_length=length;
|
||||||
set_name(name_par,0,cs);
|
set_name(name_par,0,cs);
|
||||||
|
@ -57,7 +57,7 @@ bool Item_str_buff::cmp(void)
|
|||||||
else if (null_value)
|
else if (null_value)
|
||||||
return 0; // new and old value was null
|
return 0; // new and old value was null
|
||||||
else
|
else
|
||||||
tmp= sortcmp(&value,res,item->charset()) != 0;
|
tmp= sortcmp(&value,res,item->collation.collation) != 0;
|
||||||
if (tmp)
|
if (tmp)
|
||||||
value.copy(*res); // Remember for next cmp
|
value.copy(*res); // Remember for next cmp
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -151,15 +151,17 @@ void Item_bool_func2::fix_length_and_dec()
|
|||||||
uint strong= 0;
|
uint strong= 0;
|
||||||
uint weak= 0;
|
uint weak= 0;
|
||||||
|
|
||||||
if ((args[0]->derivation() < args[1]->derivation()) &&
|
if ((args[0]->collation.derivation < args[1]->collation.derivation) &&
|
||||||
!my_charset_same(args[0]->charset(), args[1]->charset()) &&
|
!my_charset_same(args[0]->collation.collation,
|
||||||
(args[0]->charset()->state & MY_CS_UNICODE))
|
args[1]->collation.collation) &&
|
||||||
|
(args[0]->collation.collation->state & MY_CS_UNICODE))
|
||||||
{
|
{
|
||||||
weak= 1;
|
weak= 1;
|
||||||
}
|
}
|
||||||
else if ((args[1]->derivation() < args[0]->derivation()) &&
|
else if ((args[1]->collation.derivation < args[0]->collation.derivation) &&
|
||||||
!my_charset_same(args[0]->charset(), args[1]->charset()) &&
|
!my_charset_same(args[0]->collation.collation,
|
||||||
(args[1]->charset()->state & MY_CS_UNICODE))
|
args[1]->collation.collation) &&
|
||||||
|
(args[1]->collation.collation->state & MY_CS_UNICODE))
|
||||||
{
|
{
|
||||||
strong= 1;
|
strong= 1;
|
||||||
}
|
}
|
||||||
@ -172,15 +174,15 @@ void Item_bool_func2::fix_length_and_dec()
|
|||||||
String tmp, cstr;
|
String tmp, cstr;
|
||||||
String *ostr= args[weak]->val_str(&tmp);
|
String *ostr= args[weak]->val_str(&tmp);
|
||||||
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(),
|
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(),
|
||||||
args[strong]->charset());
|
args[strong]->collation.collation);
|
||||||
conv= new Item_string(cstr.ptr(),cstr.length(),cstr.charset(),
|
conv= new Item_string(cstr.ptr(),cstr.length(),cstr.charset(),
|
||||||
args[weak]->derivation());
|
args[weak]->collation.derivation);
|
||||||
((Item_string*)conv)->str_value.copy();
|
((Item_string*)conv)->str_value.copy();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
conv= new Item_func_conv_charset(args[weak],args[strong]->charset());
|
conv= new Item_func_conv_charset(args[weak],args[strong]->collation.collation);
|
||||||
conv->collation.set(args[weak]->derivation());
|
conv->collation.set(args[weak]->collation.derivation);
|
||||||
}
|
}
|
||||||
args[weak]= conv ? conv : args[weak];
|
args[weak]= conv ? conv : args[weak];
|
||||||
}
|
}
|
||||||
@ -725,13 +727,13 @@ Item_func_ifnull::val_str(String *str)
|
|||||||
if (!args[0]->null_value)
|
if (!args[0]->null_value)
|
||||||
{
|
{
|
||||||
null_value=0;
|
null_value=0;
|
||||||
res->set_charset(charset());
|
res->set_charset(collation.collation);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
res=args[1]->val_str(str);
|
res=args[1]->val_str(str);
|
||||||
if ((null_value=args[1]->null_value))
|
if ((null_value=args[1]->null_value))
|
||||||
return 0;
|
return 0;
|
||||||
res->set_charset(charset());
|
res->set_charset(collation.collation);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,12 +752,12 @@ Item_func_if::fix_length_and_dec()
|
|||||||
if (null1)
|
if (null1)
|
||||||
{
|
{
|
||||||
cached_result_type= arg2_type;
|
cached_result_type= arg2_type;
|
||||||
set_charset(args[2]->charset());
|
collation.set(args[2]->collation.collation);
|
||||||
}
|
}
|
||||||
else if (null2)
|
else if (null2)
|
||||||
{
|
{
|
||||||
cached_result_type= arg1_type;
|
cached_result_type= arg1_type;
|
||||||
set_charset(args[1]->charset());
|
collation.set(args[1]->collation.collation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -767,7 +769,7 @@ Item_func_if::fix_length_and_dec()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_charset(&my_charset_bin); // Number
|
collation.set(&my_charset_bin); // Number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -797,7 +799,7 @@ Item_func_if::val_str(String *str)
|
|||||||
Item *arg= args[0]->val_int() ? args[1] : args[2];
|
Item *arg= args[0]->val_int() ? args[1] : args[2];
|
||||||
String *res=arg->val_str(str);
|
String *res=arg->val_str(str);
|
||||||
if (res)
|
if (res)
|
||||||
res->set_charset(charset());
|
res->set_charset(collation.collation);
|
||||||
null_value=arg->null_value;
|
null_value=arg->null_value;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1182,7 +1184,7 @@ void in_string::set(uint pos,Item *item)
|
|||||||
if (!str->charset())
|
if (!str->charset())
|
||||||
{
|
{
|
||||||
CHARSET_INFO *cs;
|
CHARSET_INFO *cs;
|
||||||
if (!(cs= item->charset()))
|
if (!(cs= item->collation.collation))
|
||||||
cs= &my_charset_bin; // Should never happen for STR items
|
cs= &my_charset_bin; // Should never happen for STR items
|
||||||
str->set_charset(cs);
|
str->set_charset(cs);
|
||||||
}
|
}
|
||||||
@ -1260,7 +1262,7 @@ cmp_item* cmp_item::get_comparator(Item *item)
|
|||||||
{
|
{
|
||||||
switch (item->result_type()) {
|
switch (item->result_type()) {
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
return new cmp_item_sort_string(item->charset());
|
return new cmp_item_sort_string(item->collation.collation);
|
||||||
break;
|
break;
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
return new cmp_item_int;
|
return new cmp_item_int;
|
||||||
@ -1839,7 +1841,7 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
|
|||||||
We could also do boyer-more for non-const items, but as we would have to
|
We could also do boyer-more for non-const items, but as we would have to
|
||||||
recompute the tables for each row it's not worth it.
|
recompute the tables for each row it's not worth it.
|
||||||
*/
|
*/
|
||||||
if (args[1]->const_item() && !use_strnxfrm(charset()) &&
|
if (args[1]->const_item() && !use_strnxfrm(collation.collation) &&
|
||||||
!(specialflag & SPECIAL_NO_NEW_FUNC))
|
!(specialflag & SPECIAL_NO_NEW_FUNC))
|
||||||
{
|
{
|
||||||
String* res2 = args[1]->val_str(&tmp_value2);
|
String* res2 = args[1]->val_str(&tmp_value2);
|
||||||
@ -1860,7 +1862,7 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
|
|||||||
{
|
{
|
||||||
const char* tmp = first + 1;
|
const char* tmp = first + 1;
|
||||||
for (; *tmp != wild_many && *tmp != wild_one && *tmp != escape; tmp++) ;
|
for (; *tmp != wild_many && *tmp != wild_one && *tmp != escape; tmp++) ;
|
||||||
canDoTurboBM = (tmp == last) && !use_mb(args[0]->charset());
|
canDoTurboBM = (tmp == last) && !use_mb(args[0]->collation.collation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canDoTurboBM)
|
if (canDoTurboBM)
|
||||||
|
@ -309,9 +309,9 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
|
|||||||
break;
|
break;
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
if (max_length > 255)
|
if (max_length > 255)
|
||||||
res= new Field_blob(max_length, maybe_null, name, t_arg, charset());
|
res= new Field_blob(max_length, maybe_null, name, t_arg, collation.collation);
|
||||||
else
|
else
|
||||||
res= new Field_string(max_length, maybe_null, name, t_arg, charset());
|
res= new Field_string(max_length, maybe_null, name, t_arg, collation.collation);
|
||||||
break;
|
break;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
@ -976,13 +976,13 @@ String *Item_func_min_max::val_str(String *str)
|
|||||||
res2= args[i]->val_str(res == str ? &tmp_value : str);
|
res2= args[i]->val_str(res == str ? &tmp_value : str);
|
||||||
if (res2)
|
if (res2)
|
||||||
{
|
{
|
||||||
int cmp= sortcmp(res,res2,charset());
|
int cmp= sortcmp(res,res2,collation.collation);
|
||||||
if ((cmp_sign < 0 ? cmp : -cmp) < 0)
|
if ((cmp_sign < 0 ? cmp : -cmp) < 0)
|
||||||
res=res2;
|
res=res2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res->set_charset(charset());
|
res->set_charset(collation.collation);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
@ -1100,7 +1100,7 @@ longlong Item_func_coercibility::val_int()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
null_value= 0;
|
null_value= 0;
|
||||||
return (longlong) args[0]->derivation();
|
return (longlong) args[0]->collation.derivation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item_func_locate::fix_length_and_dec()
|
void Item_func_locate::fix_length_and_dec()
|
||||||
@ -1434,8 +1434,8 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
|
|||||||
There is no a general rule for UDF. Everything depends on
|
There is no a general rule for UDF. Everything depends on
|
||||||
the particular user definted function.
|
the particular user definted function.
|
||||||
*/
|
*/
|
||||||
if (item->charset()->state & MY_CS_BINSORT)
|
if (item->collation.collation->state & MY_CS_BINSORT)
|
||||||
func->set_charset(&my_charset_bin);
|
func->collation.set(&my_charset_bin);
|
||||||
if (item->maybe_null)
|
if (item->maybe_null)
|
||||||
func->maybe_null=1;
|
func->maybe_null=1;
|
||||||
func->with_sum_func= func->with_sum_func || item->with_sum_func;
|
func->with_sum_func= func->with_sum_func || item->with_sum_func;
|
||||||
@ -2199,7 +2199,7 @@ Item_func_set_user_var::val_str(String *str)
|
|||||||
update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin, DERIVATION_NONE);
|
update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin, DERIVATION_NONE);
|
||||||
else
|
else
|
||||||
update_hash((void*) res->ptr(), res->length(), STRING_RESULT,
|
update_hash((void*) res->ptr(), res->length(), STRING_RESULT,
|
||||||
res->charset(), args[0]->derivation());
|
res->charset(), args[0]->collation.derivation);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ String *Item_func_concat::val_str(String *str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res->set_charset(charset());
|
res->set_charset(collation.collation);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
null:
|
null:
|
||||||
@ -596,7 +596,7 @@ String *Item_func_concat_ws::val_str(String *str)
|
|||||||
use_as_buff=str;
|
use_as_buff=str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res->set_charset(charset());
|
res->set_charset(collation.collation);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
null:
|
null:
|
||||||
@ -697,7 +697,7 @@ String *Item_func_reverse::val_str(String *str)
|
|||||||
|
|
||||||
void Item_func_reverse::fix_length_and_dec()
|
void Item_func_reverse::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(*args[0]);
|
collation.set(args[0]->collation);
|
||||||
max_length = args[0]->max_length;
|
max_length = args[0]->max_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -933,7 +933,7 @@ void Item_str_func::left_right_max_length()
|
|||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
if (args[1]->const_item())
|
if (args[1]->const_item())
|
||||||
{
|
{
|
||||||
int length=(int) args[1]->val_int()*charset()->mbmaxlen;
|
int length=(int) args[1]->val_int()*collation.collation->mbmaxlen;
|
||||||
if (length <= 0)
|
if (length <= 0)
|
||||||
max_length=0;
|
max_length=0;
|
||||||
else
|
else
|
||||||
@ -944,7 +944,7 @@ void Item_str_func::left_right_max_length()
|
|||||||
|
|
||||||
void Item_func_left::fix_length_and_dec()
|
void Item_func_left::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(*args[0]);
|
collation.set(args[0]->collation);
|
||||||
left_right_max_length();
|
left_right_max_length();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,7 +971,7 @@ String *Item_func_right::val_str(String *str)
|
|||||||
|
|
||||||
void Item_func_right::fix_length_and_dec()
|
void Item_func_right::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(*args[0]);
|
collation.set(args[0]->collation);
|
||||||
left_right_max_length();
|
left_right_max_length();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,7 +1006,7 @@ void Item_func_substr::fix_length_and_dec()
|
|||||||
{
|
{
|
||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
|
|
||||||
set_charset(*args[0]);
|
collation.set(args[0]->collation);
|
||||||
if (args[1]->const_item())
|
if (args[1]->const_item())
|
||||||
{
|
{
|
||||||
int32 start=(int32) args[1]->val_int()-1;
|
int32 start=(int32) args[1]->val_int()-1;
|
||||||
@ -1314,7 +1314,7 @@ void Item_func_trim::fix_length_and_dec()
|
|||||||
if (arg_count == 1)
|
if (arg_count == 1)
|
||||||
{
|
{
|
||||||
collation.set(args[0]->collation);
|
collation.set(args[0]->collation);
|
||||||
remove.set_charset(charset());
|
remove.set_charset(collation.collation);
|
||||||
remove.set_ascii(" ",1);
|
remove.set_ascii(" ",1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1535,7 +1535,7 @@ String *Item_func_user::val_str(String *str)
|
|||||||
|
|
||||||
void Item_func_soundex::fix_length_and_dec()
|
void Item_func_soundex::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(*args[0]);
|
collation.set(args[0]->collation);
|
||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
set_if_bigger(max_length,4);
|
set_if_bigger(max_length,4);
|
||||||
}
|
}
|
||||||
@ -1567,7 +1567,7 @@ String *Item_func_soundex::val_str(String *str)
|
|||||||
{
|
{
|
||||||
String *res =args[0]->val_str(str);
|
String *res =args[0]->val_str(str);
|
||||||
char last_ch,ch;
|
char last_ch,ch;
|
||||||
CHARSET_INFO *cs= charset();
|
CHARSET_INFO *cs= collation.collation;
|
||||||
|
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
@ -1707,7 +1707,7 @@ String *Item_func_elt::val_str(String *str)
|
|||||||
}
|
}
|
||||||
null_value=0;
|
null_value=0;
|
||||||
res= args[tmp]->val_str(str);
|
res= args[tmp]->val_str(str);
|
||||||
res->set_charset(charset());
|
res->set_charset(collation.collation);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1813,7 +1813,7 @@ String *Item_func_char::val_str(String *str)
|
|||||||
int32 num=(int32) args[i]->val_int();
|
int32 num=(int32) args[i]->val_int();
|
||||||
if (!args[i]->null_value)
|
if (!args[i]->null_value)
|
||||||
#ifdef USE_MB
|
#ifdef USE_MB
|
||||||
if (use_mb(charset()))
|
if (use_mb(collation.collation))
|
||||||
{
|
{
|
||||||
if (num&0xFF000000L) {
|
if (num&0xFF000000L) {
|
||||||
str->append((char)(num>>24));
|
str->append((char)(num>>24));
|
||||||
@ -1860,7 +1860,7 @@ inline String* alloc_buffer(String *res,String *str,String *tmp_value,
|
|||||||
|
|
||||||
void Item_func_repeat::fix_length_and_dec()
|
void Item_func_repeat::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(*args[0]);
|
collation.set(args[0]->collation);
|
||||||
if (args[1]->const_item())
|
if (args[1]->const_item())
|
||||||
{
|
{
|
||||||
max_length=(long) (args[0]->max_length * args[1]->val_int());
|
max_length=(long) (args[0]->max_length * args[1]->val_int());
|
||||||
@ -2109,7 +2109,7 @@ String *Item_func_conv_charset::val_str(String *str)
|
|||||||
|
|
||||||
void Item_func_conv_charset::fix_length_and_dec()
|
void Item_func_conv_charset::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(conv_charset, DERIVATION_IMPLICIT);
|
collation.set(conv_charset, DERIVATION_IMPLICIT);
|
||||||
max_length = args[0]->max_length*conv_charset->mbmaxlen;
|
max_length = args[0]->max_length*conv_charset->mbmaxlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2192,7 +2192,7 @@ String *Item_func_set_collation::val_str(String *str)
|
|||||||
str=args[0]->val_str(str);
|
str=args[0]->val_str(str);
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
return 0;
|
return 0;
|
||||||
str->set_charset(charset());
|
str->set_charset(collation.collation);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2203,7 +2203,7 @@ void Item_func_set_collation::fix_length_and_dec()
|
|||||||
String tmp, *str= args[1]->val_str(&tmp);
|
String tmp, *str= args[1]->val_str(&tmp);
|
||||||
colname= str->c_ptr();
|
colname= str->c_ptr();
|
||||||
if (colname == binary_keyword)
|
if (colname == binary_keyword)
|
||||||
set_collation= get_charset_by_csname(args[0]->charset()->csname,
|
set_collation= get_charset_by_csname(args[0]->collation.collation->csname,
|
||||||
MY_CS_BINSORT,MYF(0));
|
MY_CS_BINSORT,MYF(0));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2214,13 +2214,14 @@ void Item_func_set_collation::fix_length_and_dec()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!set_collation || !my_charset_same(args[0]->charset(),set_collation))
|
if (!set_collation ||
|
||||||
|
!my_charset_same(args[0]->collation.collation,set_collation))
|
||||||
{
|
{
|
||||||
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
|
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
|
||||||
colname,args[0]->charset()->csname);
|
colname,args[0]->collation.collation->csname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
set_charset(set_collation, DERIVATION_EXPLICIT);
|
collation.set(set_collation, DERIVATION_EXPLICIT);
|
||||||
max_length= args[0]->max_length;
|
max_length= args[0]->max_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2237,7 +2238,7 @@ bool Item_func_set_collation::eq(const Item *item, bool binary_cmp) const
|
|||||||
func_name() != item_func->func_name())
|
func_name() != item_func->func_name())
|
||||||
return 0;
|
return 0;
|
||||||
Item_func_set_collation *item_func_sc=(Item_func_set_collation*) item;
|
Item_func_set_collation *item_func_sc=(Item_func_set_collation*) item;
|
||||||
if (charset() != item_func_sc->charset())
|
if (collation.collation != item_func_sc->collation.collation)
|
||||||
return 0;
|
return 0;
|
||||||
for (uint i=0; i < arg_count ; i++)
|
for (uint i=0; i < arg_count ; i++)
|
||||||
if (!args[i]->eq(item_func_sc->args[i], binary_cmp))
|
if (!args[i]->eq(item_func_sc->args[i], binary_cmp))
|
||||||
@ -2539,7 +2540,7 @@ String *Item_func_quote::val_str(String *str)
|
|||||||
}
|
}
|
||||||
*to= '\'';
|
*to= '\'';
|
||||||
str->length(new_length);
|
str->length(new_length);
|
||||||
str->set_charset(charset());
|
str->set_charset(collation.collation);
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
null:
|
null:
|
||||||
|
@ -153,7 +153,7 @@ public:
|
|||||||
Item_str_conv(Item *item) :Item_str_func(item) {}
|
Item_str_conv(Item *item) :Item_str_func(item) {}
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(*args[0]);
|
collation.set(args[0]->collation);
|
||||||
max_length = args[0]->max_length;
|
max_length = args[0]->max_length;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -335,12 +335,11 @@ public:
|
|||||||
class Item_func_database :public Item_str_func
|
class Item_func_database :public Item_str_func
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item_func_database() { set_charset(DERIVATION_IMPLICIT); }
|
Item_func_database() { collation.set(system_charset_info,DERIVATION_IMPLICIT); }
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
|
max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
|
||||||
set_charset(system_charset_info);
|
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "database"; }
|
const char *func_name() const { return "database"; }
|
||||||
};
|
};
|
||||||
@ -348,12 +347,11 @@ public:
|
|||||||
class Item_func_user :public Item_str_func
|
class Item_func_user :public Item_str_func
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Item_func_user() { set_charset(DERIVATION_IMPLICIT); }
|
Item_func_user() { collation.set(system_charset_info, DERIVATION_IMPLICIT); }
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length= (USERNAME_LENGTH+HOSTNAME_LENGTH+1)*system_charset_info->mbmaxlen;
|
max_length= (USERNAME_LENGTH+HOSTNAME_LENGTH+1)*system_charset_info->mbmaxlen;
|
||||||
set_charset(system_charset_info);
|
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "user"; }
|
const char *func_name() const { return "user"; }
|
||||||
};
|
};
|
||||||
@ -417,7 +415,7 @@ public:
|
|||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
max_length=args[0]->max_length+(args[0]->max_length-args[0]->decimals)/3;
|
max_length=args[0]->max_length+(args[0]->max_length-args[0]->decimals)/3;
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "format"; }
|
const char *func_name() const { return "format"; }
|
||||||
@ -431,7 +429,7 @@ public:
|
|||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
maybe_null=0; max_length=arg_count;
|
maybe_null=0; max_length=arg_count;
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "char"; }
|
const char *func_name() const { return "char"; }
|
||||||
@ -481,7 +479,7 @@ public:
|
|||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0; max_length=64;
|
decimals=0; max_length=64;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -496,7 +494,7 @@ public:
|
|||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0; max_length=args[0]->max_length*2;
|
decimals=0; max_length=args[0]->max_length*2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -517,7 +515,7 @@ public:
|
|||||||
}
|
}
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(&my_charset_bin);
|
collation.set(&my_charset_bin);
|
||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
}
|
}
|
||||||
void print(String *str) { print_op(str); }
|
void print(String *str) { print_op(str); }
|
||||||
@ -533,7 +531,7 @@ public:
|
|||||||
const char *func_name() const { return "load_file"; }
|
const char *func_name() const { return "load_file"; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(&my_charset_bin, DERIVATION_COERCIBLE);
|
collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
max_length=MAX_BLOB_WIDTH;
|
max_length=MAX_BLOB_WIDTH;
|
||||||
}
|
}
|
||||||
@ -570,7 +568,7 @@ public:
|
|||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(*args[0]);
|
collation.set(args[0]->collation);
|
||||||
max_length= args[0]->max_length * 2 + 2;
|
max_length= args[0]->max_length * 2 + 2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -615,7 +613,7 @@ public:
|
|||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length=40; // should be enough
|
max_length=40; // should be enough
|
||||||
set_charset(default_charset());
|
collation.set(system_charset_info);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -628,6 +626,6 @@ public:
|
|||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length=40; // should be enough
|
max_length=40; // should be enough
|
||||||
set_charset(default_charset());
|
collation.set(system_charset_info);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -193,7 +193,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||||||
max_length=float_length(decimals);
|
max_length=float_length(decimals);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
cmp_charset= item->charset();
|
cmp_charset= item->collation.collation;
|
||||||
max_length=item->max_length;
|
max_length=item->max_length;
|
||||||
}
|
}
|
||||||
decimals=item->decimals;
|
decimals=item->decimals;
|
||||||
|
@ -574,7 +574,7 @@ void Item_func_curdate::fix_length_and_dec()
|
|||||||
struct tm tm_tmp,*start;
|
struct tm tm_tmp,*start;
|
||||||
time_t query_start=current_thd->query_start();
|
time_t query_start=current_thd->query_start();
|
||||||
|
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=10*default_charset()->mbmaxlen;
|
max_length=10*default_charset()->mbmaxlen;
|
||||||
localtime_r(&query_start,&tm_tmp);
|
localtime_r(&query_start,&tm_tmp);
|
||||||
@ -617,7 +617,7 @@ void Item_func_curtime::fix_length_and_dec()
|
|||||||
max_length=8*cs->mbmaxlen;
|
max_length=8*cs->mbmaxlen;
|
||||||
localtime_r(&query_start,&tm_tmp);
|
localtime_r(&query_start,&tm_tmp);
|
||||||
start=&tm_tmp;
|
start=&tm_tmp;
|
||||||
set_charset(cs);
|
collation.set(cs);
|
||||||
value=(longlong) ((ulong) ((uint) start->tm_hour)*10000L+
|
value=(longlong) ((ulong) ((uint) start->tm_hour)*10000L+
|
||||||
(ulong) (((uint) start->tm_min)*100L+
|
(ulong) (((uint) start->tm_min)*100L+
|
||||||
(uint) start->tm_sec));
|
(uint) start->tm_sec));
|
||||||
@ -644,7 +644,7 @@ void Item_func_now::fix_length_and_dec()
|
|||||||
|
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=19*cs->mbmaxlen;
|
max_length=19*cs->mbmaxlen;
|
||||||
set_charset(cs);
|
collation.set(cs);
|
||||||
localtime_r(&query_start,&tm_tmp);
|
localtime_r(&query_start,&tm_tmp);
|
||||||
start=&tm_tmp;
|
start=&tm_tmp;
|
||||||
value=((longlong) ((ulong) ((uint) start->tm_year+1900)*10000L+
|
value=((longlong) ((ulong) ((uint) start->tm_year+1900)*10000L+
|
||||||
@ -1130,7 +1130,7 @@ bool Item_func_from_unixtime::get_date(TIME *ltime,
|
|||||||
void Item_date_add_interval::fix_length_and_dec()
|
void Item_date_add_interval::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
enum_field_types arg0_field_type;
|
enum_field_types arg0_field_type;
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
max_length=26*MY_CHARSET_BIN_MB_MAXLEN;
|
max_length=26*MY_CHARSET_BIN_MB_MAXLEN;
|
||||||
value.alloc(32);
|
value.alloc(32);
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=2*default_charset()->mbmaxlen;
|
max_length=2*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
enum Item_result result_type () const { return STRING_RESULT; }
|
enum Item_result result_type () const { return STRING_RESULT; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=10*default_charset()->mbmaxlen;
|
max_length=10*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
@ -254,7 +254,7 @@ public:
|
|||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=1*default_charset()->mbmaxlen;
|
max_length=1*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
@ -270,7 +270,7 @@ class Item_func_dayname :public Item_func_weekday
|
|||||||
enum Item_result result_type () const { return STRING_RESULT; }
|
enum Item_result result_type () const { return STRING_RESULT; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=9*default_charset()->mbmaxlen;
|
max_length=9*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
@ -322,7 +322,7 @@ public:
|
|||||||
const char *func_name() const { return "date"; }
|
const char *func_name() const { return "date"; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=10*default_charset()->mbmaxlen;
|
max_length=10*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
@ -440,7 +440,7 @@ class Item_func_from_unixtime :public Item_date_func
|
|||||||
const char *func_name() const { return "from_unixtime"; }
|
const char *func_name() const { return "from_unixtime"; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=19*default_charset()->mbmaxlen;
|
max_length=19*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
@ -457,7 +457,7 @@ public:
|
|||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
max_length=13*default_charset()->mbmaxlen;
|
max_length=13*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
@ -529,12 +529,12 @@ public:
|
|||||||
String *tmp=args[0]->val_str(a);
|
String *tmp=args[0]->val_str(a);
|
||||||
null_value=args[0]->null_value;
|
null_value=args[0]->null_value;
|
||||||
if (tmp)
|
if (tmp)
|
||||||
tmp->set_charset(charset());
|
tmp->set_charset(collation.collation);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
}
|
}
|
||||||
void print(String *str);
|
void print(String *str);
|
||||||
@ -547,7 +547,7 @@ public:
|
|||||||
Item_char_typecast(Item *a) :Item_typecast(a) {}
|
Item_char_typecast(Item *a) :Item_typecast(a) {}
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(default_charset());
|
collation.set(default_charset());
|
||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -930,7 +930,7 @@ get_mm_leaf(PARAM *param, Field *field, KEY_PART *key_part,
|
|||||||
{
|
{
|
||||||
bool like_error;
|
bool like_error;
|
||||||
char buff1[MAX_FIELD_WIDTH],*min_str,*max_str;
|
char buff1[MAX_FIELD_WIDTH],*min_str,*max_str;
|
||||||
String tmp(buff1,sizeof(buff1),value->charset()),*res;
|
String tmp(buff1,sizeof(buff1),value->collation.collation),*res;
|
||||||
uint length,offset,min_length,max_length;
|
uint length,offset,min_length,max_length;
|
||||||
|
|
||||||
if (!field->optimize_range(param->real_keynr[key_part->key]))
|
if (!field->optimize_range(param->real_keynr[key_part->key]))
|
||||||
|
@ -607,7 +607,7 @@ public:
|
|||||||
{
|
{
|
||||||
Item_field *item= (Item_field*) value_arg;
|
Item_field *item= (Item_field*) value_arg;
|
||||||
if (!(value=new Item_string(item->field_name, strlen(item->field_name),
|
if (!(value=new Item_string(item->field_name, strlen(item->field_name),
|
||||||
item->charset())))
|
item->collation.collation)))
|
||||||
value=value_arg; /* Give error message later */
|
value=value_arg; /* Give error message later */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -326,9 +326,9 @@ void field_str::add()
|
|||||||
if (length > max_length)
|
if (length > max_length)
|
||||||
max_length = length;
|
max_length = length;
|
||||||
|
|
||||||
if (sortcmp(res, &min_arg,item->charset()) < 0)
|
if (sortcmp(res, &min_arg,item->collation.collation) < 0)
|
||||||
min_arg.copy(*res);
|
min_arg.copy(*res);
|
||||||
if (sortcmp(res, &max_arg,item->charset()) > 0)
|
if (sortcmp(res, &max_arg,item->collation.collation) > 0)
|
||||||
max_arg.copy(*res);
|
max_arg.copy(*res);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,7 +736,7 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
|
|||||||
{
|
{
|
||||||
if (must_be_blob)
|
if (must_be_blob)
|
||||||
{
|
{
|
||||||
if (item->charset() == &my_charset_bin)
|
if (item->collation.collation == &my_charset_bin)
|
||||||
answer->append("TINYBLOB", 8);
|
answer->append("TINYBLOB", 8);
|
||||||
else
|
else
|
||||||
answer->append("TINYTEXT", 8);
|
answer->append("TINYTEXT", 8);
|
||||||
@ -754,21 +754,21 @@ void field_str::get_opt_type(String *answer, ha_rows total_rows)
|
|||||||
}
|
}
|
||||||
else if (max_length < (1L << 16))
|
else if (max_length < (1L << 16))
|
||||||
{
|
{
|
||||||
if (item->charset() == &my_charset_bin)
|
if (item->collation.collation == &my_charset_bin)
|
||||||
answer->append("BLOB", 4);
|
answer->append("BLOB", 4);
|
||||||
else
|
else
|
||||||
answer->append("TEXT", 4);
|
answer->append("TEXT", 4);
|
||||||
}
|
}
|
||||||
else if (max_length < (1L << 24))
|
else if (max_length < (1L << 24))
|
||||||
{
|
{
|
||||||
if (item->charset() == &my_charset_bin)
|
if (item->collation.collation == &my_charset_bin)
|
||||||
answer->append("MEDIUMBLOB", 10);
|
answer->append("MEDIUMBLOB", 10);
|
||||||
else
|
else
|
||||||
answer->append("MEDIUMTEXT", 10);
|
answer->append("MEDIUMTEXT", 10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (item->charset() == &my_charset_bin)
|
if (item->collation.collation == &my_charset_bin)
|
||||||
answer->append("LONGBLOB", 8);
|
answer->append("LONGBLOB", 8);
|
||||||
else
|
else
|
||||||
answer->append("LONGTEXT", 8);
|
answer->append("LONGTEXT", 8);
|
||||||
|
@ -4229,9 +4229,9 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
|||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
if (item_sum->max_length > 255)
|
if (item_sum->max_length > 255)
|
||||||
return new Field_blob(item_sum->max_length,maybe_null,
|
return new Field_blob(item_sum->max_length,maybe_null,
|
||||||
item->name,table,item->charset());
|
item->name,table,item->collation.collation);
|
||||||
return new Field_string(item_sum->max_length,maybe_null,
|
return new Field_string(item_sum->max_length,maybe_null,
|
||||||
item->name,table,item->charset());
|
item->name,table,item->collation.collation);
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
// This case should never be choosen
|
// This case should never be choosen
|
||||||
@ -4288,10 +4288,10 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
|||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
if (item->max_length > 255)
|
if (item->max_length > 255)
|
||||||
new_field= new Field_blob(item->max_length,maybe_null,
|
new_field= new Field_blob(item->max_length,maybe_null,
|
||||||
item->name,table,item->charset());
|
item->name,table,item->collation.collation);
|
||||||
else
|
else
|
||||||
new_field= new Field_string(item->max_length,maybe_null,
|
new_field= new Field_string(item->max_length,maybe_null,
|
||||||
item->name,table,item->charset());
|
item->name,table,item->collation.collation);
|
||||||
break;
|
break;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user