Commit 8f90a032 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

sql_yacc.yy, item_strfunc.cc:

  Two separate functions charset() and collatio()
item_strfunc.h:
  Two separate functions charset() and collation()
parent 7db4ec29
......@@ -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 @@ class Item_func_charset :public Item_str_func
};
};
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 ')'
......
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