sql_yacc.yy, item_strfunc.cc:
Two separate functions charset() and collatio() item_strfunc.h: Two separate functions charset() and collation() sql/item_strfunc.cc: Two separate functions charset() and collatio() sql/item_strfunc.h: Two separate functions charset() and collation() sql/sql_yacc.yy: Two separate functions charset() and collatio()
This commit is contained in:
parent
4d1cb030db
commit
f047e28068
@ -2228,6 +2228,17 @@ String *Item_func_charset::val_str(String *str)
|
||||
{
|
||||
String *res = args[0]->val_str(str);
|
||||
|
||||
if ((null_value=(args[0]->null_value || !res->charset())))
|
||||
return 0;
|
||||
str->copy(res->charset()->csname,strlen(res->charset()->csname),
|
||||
&my_charset_latin1, thd_charset());
|
||||
return str;
|
||||
}
|
||||
|
||||
String *Item_func_collation::val_str(String *str)
|
||||
{
|
||||
String *res = args[0]->val_str(str);
|
||||
|
||||
if ((null_value=(args[0]->null_value || !res->charset())))
|
||||
return 0;
|
||||
str->copy(res->charset()->name,strlen(res->charset()->name),
|
||||
|
@ -616,6 +616,19 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
class Item_func_collation :public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_collation(Item *a) :Item_str_func(a) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "collation"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
max_length=40; // should be enough
|
||||
set_charset(thd_charset());
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************
|
||||
Spatial functions
|
||||
|
@ -2156,6 +2156,8 @@ simple_expr:
|
||||
{ $$= new Item_func_charset($3); }
|
||||
| COALESCE '(' expr_list ')'
|
||||
{ $$= new Item_func_coalesce(* $3); }
|
||||
| COLLATION_SYM '(' expr ')'
|
||||
{ $$= new Item_func_collation($3); }
|
||||
| CONCAT '(' expr_list ')'
|
||||
{ $$= new Item_func_concat(* $3); }
|
||||
| CONCAT_WS '(' expr ',' expr_list ')'
|
||||
|
Loading…
x
Reference in New Issue
Block a user